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 |
1 |
Correct |
24 ms |
18236 KB |
Output is correct |
2 |
Correct |
23 ms |
18188 KB |
Output is correct |
3 |
Correct |
24 ms |
18328 KB |
Output is correct |
4 |
Correct |
179 ms |
24244 KB |
Output is correct |
5 |
Correct |
176 ms |
23600 KB |
Output is correct |
6 |
Correct |
188 ms |
23948 KB |
Output is correct |
7 |
Correct |
184 ms |
23600 KB |
Output is correct |
8 |
Correct |
23 ms |
18232 KB |
Output is correct |
9 |
Correct |
24 ms |
18228 KB |
Output is correct |
10 |
Correct |
166 ms |
23084 KB |
Output is correct |
11 |
Correct |
23 ms |
18236 KB |
Output is correct |
12 |
Correct |
196 ms |
23344 KB |
Output is correct |
13 |
Correct |
26 ms |
18236 KB |
Output is correct |
14 |
Correct |
194 ms |
23844 KB |
Output is correct |
15 |
Correct |
27 ms |
18228 KB |
Output is correct |
16 |
Correct |
175 ms |
23804 KB |
Output is correct |
17 |
Correct |
24 ms |
18288 KB |
Output is correct |
18 |
Correct |
191 ms |
25904 KB |
Output is correct |
19 |
Correct |
24 ms |
18236 KB |
Output is correct |
20 |
Correct |
24 ms |
18348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
18236 KB |
Output is correct |
2 |
Correct |
174 ms |
23032 KB |
Output is correct |
3 |
Correct |
29 ms |
18228 KB |
Output is correct |
4 |
Correct |
25 ms |
18236 KB |
Output is correct |
5 |
Correct |
196 ms |
36044 KB |
Output is correct |
6 |
Correct |
22 ms |
18228 KB |
Output is correct |
7 |
Correct |
179 ms |
23088 KB |
Output is correct |
8 |
Correct |
183 ms |
23276 KB |
Output is correct |
9 |
Correct |
179 ms |
23204 KB |
Output is correct |
10 |
Correct |
172 ms |
23640 KB |
Output is correct |
11 |
Correct |
180 ms |
25384 KB |
Output is correct |
12 |
Correct |
197 ms |
26340 KB |
Output is correct |
13 |
Correct |
223 ms |
29960 KB |
Output is correct |
14 |
Correct |
229 ms |
34100 KB |
Output is correct |
15 |
Correct |
236 ms |
33972 KB |
Output is correct |
16 |
Correct |
235 ms |
34016 KB |
Output is correct |
17 |
Correct |
24 ms |
18236 KB |
Output is correct |
18 |
Correct |
25 ms |
18236 KB |
Output is correct |
19 |
Correct |
189 ms |
26892 KB |
Output is correct |
20 |
Correct |
36 ms |
18232 KB |
Output is correct |
21 |
Correct |
203 ms |
31640 KB |
Output is correct |
22 |
Correct |
32 ms |
18236 KB |
Output is correct |
23 |
Correct |
21 ms |
18196 KB |
Output is correct |
24 |
Correct |
24 ms |
18236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
18284 KB |
Output is correct |
2 |
Correct |
24 ms |
18236 KB |
Output is correct |
3 |
Correct |
22 ms |
18388 KB |
Output is correct |
4 |
Correct |
27 ms |
18292 KB |
Output is correct |
5 |
Correct |
29 ms |
18300 KB |
Output is correct |
6 |
Correct |
25 ms |
18236 KB |
Output is correct |
7 |
Correct |
25 ms |
18216 KB |
Output is correct |
8 |
Correct |
26 ms |
18368 KB |
Output is correct |
9 |
Correct |
25 ms |
18268 KB |
Output is correct |
10 |
Correct |
26 ms |
18200 KB |
Output is correct |
11 |
Correct |
25 ms |
18352 KB |
Output is correct |
12 |
Correct |
24 ms |
18364 KB |
Output is correct |
13 |
Correct |
26 ms |
18376 KB |
Output is correct |
14 |
Correct |
25 ms |
18384 KB |
Output is correct |
15 |
Correct |
28 ms |
18184 KB |
Output is correct |
16 |
Correct |
24 ms |
18256 KB |
Output is correct |
17 |
Correct |
25 ms |
18228 KB |
Output is correct |
18 |
Correct |
23 ms |
18236 KB |
Output is correct |
19 |
Correct |
24 ms |
18236 KB |
Output is correct |
20 |
Correct |
40 ms |
18224 KB |
Output is correct |
21 |
Correct |
27 ms |
18204 KB |
Output is correct |
22 |
Correct |
22 ms |
18236 KB |
Output is correct |
23 |
Correct |
29 ms |
18236 KB |
Output is correct |
24 |
Correct |
23 ms |
18356 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
18236 KB |
Output is correct |
2 |
Correct |
23 ms |
18188 KB |
Output is correct |
3 |
Correct |
24 ms |
18328 KB |
Output is correct |
4 |
Correct |
179 ms |
24244 KB |
Output is correct |
5 |
Correct |
176 ms |
23600 KB |
Output is correct |
6 |
Correct |
188 ms |
23948 KB |
Output is correct |
7 |
Correct |
184 ms |
23600 KB |
Output is correct |
8 |
Correct |
23 ms |
18232 KB |
Output is correct |
9 |
Correct |
24 ms |
18228 KB |
Output is correct |
10 |
Correct |
166 ms |
23084 KB |
Output is correct |
11 |
Correct |
23 ms |
18236 KB |
Output is correct |
12 |
Correct |
196 ms |
23344 KB |
Output is correct |
13 |
Correct |
26 ms |
18236 KB |
Output is correct |
14 |
Correct |
194 ms |
23844 KB |
Output is correct |
15 |
Correct |
27 ms |
18228 KB |
Output is correct |
16 |
Correct |
175 ms |
23804 KB |
Output is correct |
17 |
Correct |
24 ms |
18288 KB |
Output is correct |
18 |
Correct |
191 ms |
25904 KB |
Output is correct |
19 |
Correct |
24 ms |
18236 KB |
Output is correct |
20 |
Correct |
24 ms |
18348 KB |
Output is correct |
21 |
Correct |
25 ms |
18236 KB |
Output is correct |
22 |
Correct |
174 ms |
23032 KB |
Output is correct |
23 |
Correct |
29 ms |
18228 KB |
Output is correct |
24 |
Correct |
25 ms |
18236 KB |
Output is correct |
25 |
Correct |
196 ms |
36044 KB |
Output is correct |
26 |
Correct |
22 ms |
18228 KB |
Output is correct |
27 |
Correct |
179 ms |
23088 KB |
Output is correct |
28 |
Correct |
183 ms |
23276 KB |
Output is correct |
29 |
Correct |
179 ms |
23204 KB |
Output is correct |
30 |
Correct |
172 ms |
23640 KB |
Output is correct |
31 |
Correct |
180 ms |
25384 KB |
Output is correct |
32 |
Correct |
197 ms |
26340 KB |
Output is correct |
33 |
Correct |
223 ms |
29960 KB |
Output is correct |
34 |
Correct |
229 ms |
34100 KB |
Output is correct |
35 |
Correct |
236 ms |
33972 KB |
Output is correct |
36 |
Correct |
235 ms |
34016 KB |
Output is correct |
37 |
Correct |
24 ms |
18236 KB |
Output is correct |
38 |
Correct |
25 ms |
18236 KB |
Output is correct |
39 |
Correct |
189 ms |
26892 KB |
Output is correct |
40 |
Correct |
36 ms |
18232 KB |
Output is correct |
41 |
Correct |
203 ms |
31640 KB |
Output is correct |
42 |
Correct |
32 ms |
18236 KB |
Output is correct |
43 |
Correct |
21 ms |
18196 KB |
Output is correct |
44 |
Correct |
24 ms |
18236 KB |
Output is correct |
45 |
Correct |
26 ms |
18284 KB |
Output is correct |
46 |
Correct |
24 ms |
18236 KB |
Output is correct |
47 |
Correct |
22 ms |
18388 KB |
Output is correct |
48 |
Correct |
27 ms |
18292 KB |
Output is correct |
49 |
Correct |
29 ms |
18300 KB |
Output is correct |
50 |
Correct |
25 ms |
18236 KB |
Output is correct |
51 |
Correct |
25 ms |
18216 KB |
Output is correct |
52 |
Correct |
26 ms |
18368 KB |
Output is correct |
53 |
Correct |
25 ms |
18268 KB |
Output is correct |
54 |
Correct |
26 ms |
18200 KB |
Output is correct |
55 |
Correct |
25 ms |
18352 KB |
Output is correct |
56 |
Correct |
24 ms |
18364 KB |
Output is correct |
57 |
Correct |
26 ms |
18376 KB |
Output is correct |
58 |
Correct |
25 ms |
18384 KB |
Output is correct |
59 |
Correct |
28 ms |
18184 KB |
Output is correct |
60 |
Correct |
24 ms |
18256 KB |
Output is correct |
61 |
Correct |
25 ms |
18228 KB |
Output is correct |
62 |
Correct |
23 ms |
18236 KB |
Output is correct |
63 |
Correct |
24 ms |
18236 KB |
Output is correct |
64 |
Correct |
40 ms |
18224 KB |
Output is correct |
65 |
Correct |
27 ms |
18204 KB |
Output is correct |
66 |
Correct |
22 ms |
18236 KB |
Output is correct |
67 |
Correct |
29 ms |
18236 KB |
Output is correct |
68 |
Correct |
23 ms |
18356 KB |
Output is correct |
69 |
Correct |
24 ms |
18236 KB |
Output is correct |
70 |
Correct |
23 ms |
18236 KB |
Output is correct |
71 |
Correct |
23 ms |
18284 KB |
Output is correct |
72 |
Correct |
180 ms |
23856 KB |
Output is correct |
73 |
Correct |
191 ms |
23504 KB |
Output is correct |
74 |
Correct |
198 ms |
23776 KB |
Output is correct |
75 |
Correct |
175 ms |
23636 KB |
Output is correct |
76 |
Correct |
25 ms |
18228 KB |
Output is correct |
77 |
Correct |
26 ms |
18436 KB |
Output is correct |
78 |
Correct |
170 ms |
23112 KB |
Output is correct |
79 |
Correct |
25 ms |
18224 KB |
Output is correct |
80 |
Correct |
173 ms |
23548 KB |
Output is correct |
81 |
Correct |
24 ms |
18236 KB |
Output is correct |
82 |
Correct |
180 ms |
23860 KB |
Output is correct |
83 |
Correct |
26 ms |
18236 KB |
Output is correct |
84 |
Correct |
178 ms |
23640 KB |
Output is correct |
85 |
Correct |
23 ms |
18236 KB |
Output is correct |
86 |
Correct |
187 ms |
25936 KB |
Output is correct |
87 |
Correct |
25 ms |
18236 KB |
Output is correct |
88 |
Correct |
198 ms |
36048 KB |
Output is correct |
89 |
Correct |
25 ms |
18232 KB |
Output is correct |
90 |
Correct |
173 ms |
23088 KB |
Output is correct |
91 |
Correct |
187 ms |
23340 KB |
Output is correct |
92 |
Correct |
176 ms |
23132 KB |
Output is correct |
93 |
Correct |
174 ms |
23600 KB |
Output is correct |
94 |
Correct |
173 ms |
25392 KB |
Output is correct |
95 |
Correct |
194 ms |
26264 KB |
Output is correct |
96 |
Correct |
221 ms |
30140 KB |
Output is correct |
97 |
Correct |
230 ms |
33988 KB |
Output is correct |
98 |
Correct |
224 ms |
34004 KB |
Output is correct |
99 |
Correct |
226 ms |
34188 KB |
Output is correct |
100 |
Correct |
24 ms |
18224 KB |
Output is correct |
101 |
Correct |
27 ms |
18152 KB |
Output is correct |
102 |
Correct |
184 ms |
26928 KB |
Output is correct |
103 |
Correct |
24 ms |
18228 KB |
Output is correct |
104 |
Correct |
201 ms |
31536 KB |
Output is correct |
105 |
Correct |
24 ms |
18236 KB |
Output is correct |
106 |
Correct |
24 ms |
18236 KB |
Output is correct |
107 |
Correct |
21 ms |
18236 KB |
Output is correct |
108 |
Correct |
23 ms |
18300 KB |
Output is correct |
109 |
Correct |
26 ms |
18268 KB |
Output is correct |
110 |
Correct |
24 ms |
18252 KB |
Output is correct |
111 |
Correct |
25 ms |
18200 KB |
Output is correct |
112 |
Correct |
183 ms |
30376 KB |
Output is correct |
113 |
Correct |
184 ms |
29232 KB |
Output is correct |
114 |
Correct |
187 ms |
29976 KB |
Output is correct |
115 |
Correct |
211 ms |
29744 KB |
Output is correct |
116 |
Correct |
198 ms |
31688 KB |
Output is correct |
117 |
Correct |
26 ms |
18236 KB |
Output is correct |
118 |
Correct |
209 ms |
23884 KB |
Output is correct |
119 |
Correct |
190 ms |
23952 KB |
Output is correct |
120 |
Correct |
196 ms |
23856 KB |
Output is correct |
121 |
Correct |
198 ms |
24472 KB |
Output is correct |
122 |
Correct |
191 ms |
25392 KB |
Output is correct |
123 |
Correct |
197 ms |
26672 KB |
Output is correct |
124 |
Correct |
217 ms |
30252 KB |
Output is correct |
125 |
Correct |
200 ms |
31032 KB |
Output is correct |
126 |
Correct |
214 ms |
31016 KB |
Output is correct |
127 |
Correct |
210 ms |
31308 KB |
Output is correct |
128 |
Correct |
191 ms |
27100 KB |
Output is correct |
129 |
Correct |
168 ms |
26316 KB |
Output is correct |
130 |
Correct |
24 ms |
18200 KB |
Output is correct |
131 |
Correct |
23 ms |
18236 KB |
Output is correct |
132 |
Correct |
23 ms |
18284 KB |
Output is correct |
133 |
Correct |
23 ms |
18236 KB |
Output is correct |
134 |
Correct |
25 ms |
18236 KB |
Output is correct |