| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1328912 | avighna | Infinite Race (EGOI24_infiniterace2) | C++20 | 193 ms | 19204 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
set<int> left, right;
for (int i = 1; i < n; ++i) {
right.insert(i);
}
int ans = 0;
while (q--) {
int x;
cin >> x;
if (x > 0) {
if (right.contains(x)) {
left.insert(x), right.erase(x);
} else {
left.erase(x);
for (const int &i : left) {
right.insert(i);
}
left.clear();
left.insert(x);
ans++;
}
} else {
if (left.contains(x)) {
left.erase(x), right.insert(x);
}
}
}
cout << ans << '\n';
}| # | 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... | ||||
