Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- N, K, P = list(map(int, input().split()))
- Barja = [deque()] * K
- res = 0
- for i in range(N):
- S = input().split()
- r = 0
- S[1], S[2] = int(S[1]), int(S[2])
- if S[0] == '+':
- Barja[S[1] - 1].append(S[2])
- elif len(Barja[S[1] - 1]) > 0 and Barja[S[1] - 1][-1] == S[2]:
- Barja[S[1] - 1].pop()
- else:
- res = False
- break
- for i in Barja:
- r += len(i)
- if r > res:
- res = r
- if res:
- print(res)
- else:
- print('Error')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement