Hello all :)
Can anyone give some idea or help me to solve this problem here?
It seems like straightforward SP problem, but the constraints are too large to be able to draw the graph. And I'm not really sure, how to use information of intervals to solve the problem.
So if anyone has some idea, please contribute!
Thanks,
minimario
Segment tree supporting such operations will be useful:
1) Mark element x as used
2) For interval [a, b] — are there any unused elements? If yes, give me smallest one.