for t in range(tc):
n,m,k,l,r= (int(x) for x in input().split())
for i in range(n):
ci,p=(int(x) for x in input().split())
if ci in tbl:
for j in tbl:
for i in range(m):
Just post link of sol. Not fill code
// 20 char
check your 24th and 25th line carefully…
see my solution for reference…
Read my code from line 316
why did u use else if on line 14 , we can only use if right?
i did that to make sure the value doesn’t change again…
but as such yeah it should work without that as well…
bhai mera else if lgake submit hora h only if me nhi kr raha
so what i was saying it was incorrect in my code
that’s why i used if else
but can u think of any test case which can fail if i use on only if condition
you have confused the flow of if else statements in line 18 .
eg : suppose ft = k+3
if(ft>k+1) is true and ft becomes k+2
if (ft<k-1) is false and the else condition is executed and ft becomes k.
the numbers will get skipped and you will have WA
yeah thx , but my other sol in which i didnt had else was also giving errorlink can u check this out please
and ft =k+2
if(ft>k+1) is true and ft becomes k+1
if(k-1<=ft<=k+1) becomes also true then ft becomes k.
hope you got it .
ok,i got it. Thanks bro but i was wondering what if i remove ‘=’ from expression?
Then it should work fine because k-1<ft<k+1 is valid only when ft=k .
and when ft =k+1 then ft is decreased to k (and when ft =k-1 then increased to k)
because the main logic remains same .
Please help with this code. Why is it giving WA ?