Блог пользователя priojeet_priyom

Автор priojeet_priyom, история, 6 лет назад, По-английски

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

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 6   Проголосовать: нравится 0 Проголосовать: не нравится

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.