This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
N = int(input())
Q = int(input())
lap = 0
last = {}
for _ in range(Q):
x = int(input())
if x > 0:
if x in last:
if last[x] == lap:
lap += 1
last[x] = lap
elif -x in last:
del last[-x]
print(lap)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |