How to solve the this DFS problem ?

Revision en1, by alwaysGREEEN, 2018-07-18 17:29:07

MILITARY PROBLEM

I am trying to solve this problem by running dfs from every node. I am getting TLE verdict. Please help me speed up my solution

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English alwaysGREEEN 2018-07-18 17:29:07 230 Initial revision (published)