Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9586080e5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| memoX[x][y] = currX; | ||
| memoY[x][y] = currY; |
There was a problem hiding this comment.
Memoize all traversed nodes to avoid quadratic runtime
findDest only stores the destination for the original (x, y) call site, so intermediate cells on the same descent path are recomputed from scratch when visited later. On inputs where many starts follow long chains before reaching a sink (common at this problem’s 500x500 limit), this turns the solver into roughly O((R*C)^2) neighbor scans and can time out even though path compression is expected here. Cache the destination for every cell visited during the while-walk, not just the first one.
Useful? React with 👍 / 👎.
유형: 브루트 포스 + dp
등급: 골드
url: https://www.acmicpc.net/problem/16957
개 빡세다.~