atcoder image 0 points orz

A https://atcoder.jp/contests/agc044/tasks/agc044_a image https://atcoder.jp/contests/agc044/submissions/13540997 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 image https://atcoder.jp/contests/agc044/submissions/13543797 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 using DeepL. 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.