Help with spoj problem AKBAR

Revision en1, by paramsingh, 2016-03-10 18:56:00

Hi there. I've been trying to solve for some time, but the only thing I can seem to come up with is starting a BFS from each of the soldiers as the source until the soldier's strength depth. However, that approach gives me a TLE. Any help regarding how to solve this problem would be appreciated. Thanks.

Here's the code for my approach that I tried (TLE):

Tags spoj, bfs


  Rev. Lang. By When Δ Comment
en1 English paramsingh 2016-03-10 18:56:00 482 Initial revision (published)