# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1173271 | jiahc | Infinite Race (EGOI24_infiniterace2) | C++20 | 23 ms | 1204 KiB |
#include <bits/stdc++.h>
using namespace std;
int n, q, a[200010];
int main() {
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i++) a[i] = -1;
int ans = 0;
while(q--) {
int x;
scanf("%d", &x);
if (x > 0) {
//a[x]++;
if (a[x] == ans) {
a[x]++;
ans++;
} else {
a[x] = ans;
}
} else if (a[-x] >= 0) {
a[-x]--;
}
}
//int ans = 0;
//for (int i = 1; i <= n; i++) {
// if (a[i] >= 1) ans = max(ans, a[i] - 1);
//}
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |