The agent must kill all the terrorists before kk minutes. And to kill all the terrorists, the total number of bullets required to kill all the terrorists must be less than or equal to the number of bullets (r6r*6) the agent has in his possession. The path from each cell leads the agent to a certain cell. The paths/roads are one way. Two/more different cells can have paths that lead to one cell. The agent must not go back to a cell that is already visited. Because if he does, he will fall into an infinite loop. If aia_i is denoted by 00, the agent cannot move further. So, after ensuring Srikant has enough bullets to kill all the terrorists, run a dfsdfs and check is it possible to go all the cells where terrorists are stayed. If it is possible, calculate the required time. Complexity O(n)O(n) or O(nlogn)O(nlogn) depending on your implementation.

Statistics

73% Solution Ratio
faria_efaEarliest, Jul '21
Nafis2003174.132453Fastest, 0.0s
Nafis2003174.132453Lightest, 75 kB
antihashShortest, 824B
Toph uses cookies. By continuing you agree to our Cookie Policy.