|  | 
|  | 
| | IN: 3 0OUT: 0
 
 This test helped me :D
 Good luck!
103
 1 5
 10 6
 8 6
 
 16
 4
 16 13
 2 11
 9 2
 7 3
 
 17
 6
 4 7
 3 9
 2 9
 1 11
 17 12
 17 14
 
 10
 3
 3 5
 7 2
 8 1
Try
 8
 4
 2 4
 4 6
 6 8
 8 2
 
 Ans: 2 6 or 4 8
How many structures  need quick solution.I worked with segments [i,j] on [1,N] and used
 1: short num[50000] for quicksort of segments;
 2: short prev[50000] for fathes of segments. Segment I is father of segment J if I smallest segment containing J.
 3: vector<short>sons[50000] for sons of segments.
 Last structure very slow and I had bad Ac time 0.95.
 Idite na  
 Edited by author 13.08.2008 06:08
Is first test sample or not? Correct solution gets WA #1 :((( Extra strange! First test is sample, my CORRECT program passes it (with many others) on my computer, and gets WA #1 on timus... I've initialized all variables. Where is problem - in compiler, validator or (???) my code? The first test can be not the same as sample... I passed 1st test, but had TLE  on 12th;)
 Edited by author 05.03.2007 18:45
 First test is sample - I've found my stupid bug. AC now :) | 
 | 
|