We can use a sorted set in place of the linked list mentioned in the official solution.
Implementation
Time Complexity:
from typing import NamedTupleclass Boot(NamedTuple):max_depth: intmax_steps: intindex: intclass Tile:
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!