time is mooney
My problem with this problem is that I don’t understand why the answer for the sample input is 24. Couldn’t Bessie’s trip be 1→3→2→3→2→3→1 and make 20+10+20+10+20-1*6^2=80-36=44 ?
I know that I must be missing something from the statement but I can’t figure out what.
The roads are one-way.
Thanks a lot! I somehow kept missing that.