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