theweirdki9's blog

By theweirdki9, history, 3 hours ago, In English

I read the editorial and it says that we need to find an intermediate node if we can't reach x to y directly, the intermediate node could be either at the left or right of the node x (assuming x <= y). so I calculated the nearest node to left and right of each node with all possible types.

Then I iterate over all queries checking all types to the left and right and take the minimum if possible. my solution failed on 2nd test case at line 246 or something. the answer is supposed to be 3 but with my solution it is 1.

Problem Link: Colored Portals my submission: 304400011

  • Vote: I like it
  • 0
  • Vote: I do not like it