Submission #1070456

#TimeUsernameProblemLanguageResultExecution timeMemory
1070456raduvInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
45 ms2488 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 200'000; int v[MAXN]; int main() { int n, q, i, x, ans = 0, lastdeleted; cin >> n >> q; lastdeleted = 0; for(i = 1; i <= q; i++){ cin >> x; if(x < 0){ v[-x] = 0; } else{ if(v[x] > lastdeleted){ ans++; v[x] = i + 1; lastdeleted = i; } else v[x] = i; } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...