Submission #1129729

#TimeUsernameProblemLanguageResultExecution timeMemory
1129729khangrlInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
112 ms9784 KiB
#include<bits/stdc++.h> #define int long long #define pb push_back using namespace std; signed main(){ bool to[200005]={0}; set <int> s; map <int, int> mp; int n, q, ans=0; cin>>n>>q; for(int i=1; i<=q; i++){ int e; cin>>e; if(abs(e)==e){ if(s.count(e)){ ans++; s.clear(); s.insert(e); } else{ s.insert(e); } } else{ e*=-1; s.erase(e); } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...