Submission #1043192

#TimeUsernameProblemLanguageResultExecution timeMemory
1043192model_codeInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
48 ms2644 KiB
#include<bits/stdc++.h> using namespace std; typedef vector<int> vi; signed main(){ int n,q; cin >> n >> q; vi behind(n,-1); int curr = 0; while(q--){ int p; cin >> p; if(p>0){ if(behind[p]!= curr) behind[p]=curr; else { curr++; behind[p]=curr; } } else { p *= -1; behind[p]=-1; } } cout << curr; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...