Problem link
I’m a little confused by the problem statement. So are the cows only allowed to go clockwise to the right? Does initially entering the door to their room count towards d? I’m not really sure how the sample test case got 33 either.
Appreciate any tips!
Yes, they’re only allowed to go clockwise. The entering of the door does not count as a unit of distance travelled.
As for the sample test case, just try messing around with how the cows move and you should find out the optimal strategy soon enough.