help needed in graph problem

Revision en1, by brucewayne123, 2016-05-31 18:43:44

http://codeforces.net/problemset/problem/437/D i was trying this problem but i dont know why i am getting wrong answer on test 7.. my code outputs some negative value(maybe an overflow error but i checked and wasnt able to found one). please someone look through my code and help.. my submission :- http://codeforces.net/contest/437/submission/18170970 PS:- i matched my solution with some accepted one and my logic is same.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English brucewayne123 2016-05-31 18:43:44 455 Initial revision (published)