I am solving this problem on codeforces - Problem - B - Codeforces
My submission - Submission #119580369 - Codeforces
I first take all inputs of little Z’s time and mark them as true in the array x. False value denotes little z is not available at that point of time, true denotes he is available.
In the next loop, I take Little X’s times and run a loop from l to r, if that particular value between l to r is not yet used, I check if little Z is available at the time (a+i/ b+i) if yes mark used[i] as true.
At the end - calculate total time betn l and r when both are available.
I am getting WA in some test cases, looks like I am missing to count some values.
What am I doing wrong? Thanks in advance.