GUVI
Back

Just Puzzled about your testcases,(GUVI), in (Qno 11 in "SEGMENT TREE"), the code completely works for one logic but fails for the another, and the logic seems to solve all cases Please do help me out

Created 3 years ago
77 Views
2 Comments
saran
@saran
saran
@saranProfile is locked. Login
a, b, c = map(int, input().split())

l1 = list(map(int, input().split()))

q = int(input())
out = []

for i in range(q):
    x, y, z = map(str, input().split())
    x = int(x)
    y = int(y)
    if x == 1:
        if z == "A":
            l1[y-1] -= b
        else:
            l1[y-1] -= c

        if l1[y-1] < 0:
            l1[y-1] = 0
    else:
        cc = 0
        for i in range(y-1, int(z)):
            if l1[i] <= 0: cc += 1
        out.append(cc)
if len(out) < 20:
    for i in out:
        print(i)
        

I Have already unlocked the testcases and puzzled about it, Please help me out

Comments (2)
Please login to comment.
 
Powered by habitate.io Habitate