Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official. ×

Help with spoj problem AKBAR

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

Hi there. I've been trying to solve http://www.spoj.com/problems/AKBAR/ 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): https://gist.github.com/paramsingh/81d728295e6bd01860a0

Tags spoj, bfs

History

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