priojeet_priyom's blog

By priojeet_priyom, history, 5 years ago, In English

my approach to this problem is:
1. build mst using prims
2. run a bfs from any special node to find the maximum edge between special nodes and that edge is the answer for all nodes.
my submission

»
5 years ago, # |
Rev. 6   Vote: I like it 0 Vote: I do not like it

Here is an issue:

      mapp[mp(u,v)] = conn[u].size()-1;
      mapp[mp(v,u)] = conn[u].size()-1;

UPD: the second one should be conn[v].size()-1 (not u), as I understood from your code. I've just tested it, but it still gives RTE, but on test 29.

UPD2: the second RTE has just been solved. The issue was in using the same pos for both u and v. The new verdict is WA on test 33. See my submissions for more details.