renegade_warrior's blog

By renegade_warrior, history, 9 years ago, In English

http://codeforces.me/gym/100253/attachments M — Winnie-the-Pooh Needs Help . How can i solve this ?

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Removing each edge and doing bfs is too costly. In stead, we remove each vertex and do BFS finding shortest and second shortest path to each node via a different children from root. Here's my code : http://ideone.com/sCOHAQ