Div1 395 — (E. Timofey and our friends animals) : getting WA on a testcase

Revision en3, by sherlock_holms, 2017-06-06 09:17:33

Problem link : http://codeforces.me/contest/763/problem/E

I am debugging my solution against already accepted solutions for this problem, by creating large test cases. I have found something weird. Some solutions are considering even the trees which are either (< l) or (> r). I have one testcase which proves this.

testcase link : https://drive.google.com/file/d/0B088hEdwtfVCSG5KNTl1M3REdUk/view?usp=sharing -> Query is (35916, 35926). you can check from the relation ship edges (by running a loop on them) that there are only three relationship edges which are useful for this query which are [(35922, 35924), (35923, 35925), (35925, 35926)]. using this answer will be 8, but answer from accepted solutions is 9. Even manually answer is 8. Can someone please explain the problem here ?

here is link to my solution : http://codeforces.me/contest/763/submission/27576175

Tags dsu

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English sherlock_holms 2017-06-06 09:17:33 62
en2 English sherlock_holms 2017-06-06 09:16:16 12 Tiny change: 'his query . [(35922, ' -> 'his query which are [(35922, '
en1 English sherlock_holms 2017-06-06 09:15:23 893 Initial revision (published)