Please give a counter case for my code in LRQUER

Can anyone tell me why my solution for problem LRQUER from nov lunchtime is giving wrong answer on subtask #2 but correct answer on subtasks #1 and #3. https://www.codechef.com/viewsolution/16377252

This is quite tricky. It passed all the inputs I gave.

@akash_321 can u please explain what does the last while loop doing?(in the query function)

Your code fails here-

Input
1
10 9
2 2 2 2 2 2 2 2 2 2
1 1 10
2 5 11
1 1 10
2 3 1
1 1 10
2 1 5
1 1 10
2 10 19
1 1 10
Your Output
0
0
0
0
0
Expected Output
0
0
0
0
48

Your updation part has problem it seems to me.

1 Like

@vijju123 yes, updation part has a bug but and after fixing it’s giving correct output for your test case but unluckily it still didn’t pass the 2nd subtask :frowning:

code : https://www.codechef.com/viewsolution/16387263

@akash_321 it’s your searching technique that is creating problem! because after removing this technique it is giving correct output.

@vijju123 Thanks mate…

@pk301 it was due to duplicates in vector so i removed duplicates and got ac.
here https://www.codechef.com/viewsolution/16387590

@akash_321 if possible can you please look into this : https://discuss.codechef.com/questions/118737/help-in-understanding-strongly-connected-component-in-graphs

It took me lot of time to debug. Finally happy that caught the case :slight_smile:

Glad the issue stands sorted now :slight_smile: