I am having doubt on the output of https://www.codechef.com/DCOD19B/problems/PIPSQUIK

i think the output of last case given is incorrect please clarify any mods.
here is link of question

Prefer using comment section on problem page for queries.

height jump is only y2, question is poorly stated,i couldn’t understand it for long time myself. but there are hundreds of submission i think its ok!

1 Like

yep i am not able to relate the question to given input and output

Really its a doubtful one…even after so many submissions & passing the test cases its WA.

i tried multiple variations but all giving WA ,the question is not clear

Same here…& its a pretty straight qs but still so much confusion.

i agree with you

I think maybe we are missing a single corner case. if anyone finds it out please don’t tell the answer just let us know that there exists a corner case for sure.

I got the corner case but there were few seconds left only !!! :sob::sob::sob:

So whats the corner case?

If by corner case you mean “not crossing the last barrier” thing then it’s clearly explained in one of the sample cases.

The catch is, you have to increment of number of ways only when l is a non-zero value.

Yess, just we had to restrict the counter from incrementing when “l” is equal to zero…else someways were counted even when there is no lifeline.

Sorry, for creating chaos in the discussion, the question was absolutely okay !!!
Happy to solve it finally… :slightly_smiling_face:

I also got WA in this problem and not able to figure out my mistake

for case in range(int(input())):
n, h, y1, y2, l = list(map(int, input().split()))

count = 0
for i in range(n):
    typ, x = list(map(int, input().split()))
    if typ==1:
        ## goes from x to infinity
        ## eric should be able to pass it in duck mode
        if h-y1>x:
            if l>1:
                count+=1
                l-=1
            else:
                continue
        else:
            count+=1

    else:
        ## must jump
        if y2<x:
            if l > 1:
                count+=1
                l-=1
            else:
                continue
        else:
            count+=1

print(count)