Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, h = map(int, input().split())
- a = []
- for i in range(n):
- s = input().split()
- x = int(s[1])
- if s[0] == 'u':
- a += [x]
- else:
- a += [-x]
- t = 0
- MN = 0
- for i in range(n):
- t += a[i]
- if t < 0:
- MN = min(MN , -t)
- t=MN
- for I in range (n):
- if t < 0 or t > H:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement