Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INF = 10 ** 9
- fence = [(INF, 0)]
- q = int(input())
- for i in range(q):
- query = list(map(int, input().split()))
- if query[0] == 1:
- r = query[1]
- c = query[2]
- while len(fence) > 0 and r >= fence[-1][0]:
- fence.pop()
- fence.append((r, c))
- else:
- x = query[1]
- L = 0
- R = len(fence)
- while R - L > 1:
- M = (L + R) // 2
- if fence[M][0] >= x:
- L = M
- else:
- R = M
- print(fence[L][1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement