Can anyone help me solve this question

its failing one TC…

wait i am sending it

Inputs:
3 6
0 2
1 2
2 2
3 2
4 2
5 2

My Output:

0
2
4
-1
6
-1

Correct Output:

0
2
4
6
8
-1

Yeah I see ,please give me a few minutes, I know the error.

1 Like

ok thnx…let me see 2

in the line while(q.front()<=arrival)…why are u not checking for the queue to be empty???

https://ide.codingblocks.com/s/245455 Please see, now its passing.

Yeah you can add that condition if there is segmentation fault.

yeah it passed…thnx for helping me…i will resolve the doubt…