| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1346521 | julia_08 | Infinite Race (EGOI24_infiniterace2) | C++20 | 14 ms | 824 KiB |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
bool behind[MAXN], vis[MAXN];
int main(){
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
int ans = 0;
int q; cin >> q;
for(int i=1; i<n; i++) behind[i] = vis[i] = false;
vector<int> cur;
while(q--){
int x; cin >> x;
if(x > 0){
if(behind[x]){
if(vis[x]){
for(auto y : cur) vis[y] = false;
cur.clear();
}
vis[x] = true;
if(cur.empty()) ans ++;
cur.push_back(x);
}
behind[x] = true;
} else behind[-x] = vis[-x] = false;
}
// if(!cur.empty()) ans ++;
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... | ||||
