AGC044
https://gyazo.com/20040128f2ac53be6b775fd660f42e70
0 points orz
https://gyazo.com/7975351ab98d7d63ca1678e08dff6f51
I first tried to search from both 0 and N to find where they meet and TLE, and when I observed the behavior, a series of +1 hits were happening, so I modified the default cost of x to be xD if it is not searched, and then I changed it to going down from N.
WA left and I couldn't think of a reason, so I moved to B.
---
>> solve(4, 1000000000, 1000000000, 1000000000, 1)
4
1000000002
B
https://gyazo.com/b423992ded0043ff0bbdfadfc6b2c95e
I figured that if I searched every time someone left, I must not be able to find them in time, so I decided to make a map of distances in advance and update the distances of people in front of, behind, and to the left and right of the person who left.
However, I noticed that the "adjacency" changes when a person exits and changes from a 2D matrix to a graph, and also because it can be updated in a ball-and-socket manner... Death by TLE.
I'm going to check the test cases that are mocking up for now, but I feel like I should take a break since I've been in the contest for 7.5 hours today lol.
---
This page is auto-translated from /nishio/AGC044. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.