| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1342309 | mantaggez | Infinite Race (EGOI24_infiniterace2) | C++20 | 13 ms | 1732 KiB |
#include <bits/stdc++.h>
using namespace std;
const int nx = 2e5+5;
int n, q, ans;
bool b[nx];
vector<int> v;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin >> n >> q;
while(q--) {
int x; cin >> x;
int idx = abs(x);
bool lap = false;
if(x > 0) {
if(b[idx]) lap = true;
}
else {
if(!b[idx]) lap = true;
}
if(lap) {
ans++;
for(int p : v) b[p] = false;
v.clear();
}
if(x > 0) {
if(!b[idx]) {
b[idx] = true;
v.push_back(idx);
}
else {
if(b[idx]) {
b[idx] = false;
}
}
}
}
cout << ans << '\n';
return 0;
}| # | 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... | ||||
