← All problemsSign in

Safety Maze

You are standing in a $2$ x $n$ grid at block $(1,1)$. Your goal is to reach block $(2,N)$. You are given Q queries and you have to answer after each query whether its possible to reach block $(2,N)$. Each query contains 2 integers, $(Ri,Ci)$, denoting the block in row Ri and column Ci whose safety state is toggled. Initially the safety state of all blocks is $0$ which when toggled becomes $1$ and

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start