Need help on problem AKBAR — SPOJ

Revision en1, by MS1908, 2019-11-28 05:10:31

I'm currently trying to solve problem AKBAR from SPOJ. My idea is to do BFS from each soldier based on strength of that soldier, and then if there is a city that is protected by 2 soldiers, or if in the end, there is a city that is not protected then the answer is No, otherwise Yes. But for some reason, my code got WA verdict. Any help on why this happened will be really appreciated.

My code: https://ideone.com/7cGTFC

Tags #bfs, #spoj

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English MS1908 2019-11-28 05:10:31 497 Initial revision (published)