Submission #1047372

#TimeUsernameProblemLanguageResultExecution timeMemory
1047372VMaksimoski008Infinite Race (EGOI24_infiniterace2)C++17
100 / 100
72 ms9768 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, q, ans = 0; cin >> n >> q; set<int> s; while(q--) { int x; cin >> x; if(x > 0) { if(s.count(x)) { ans++; s.clear(); } s.insert(x); } else { s.erase(-x); } } 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...