Submission #1130060

#TimeUsernameProblemLanguageResultExecution timeMemory
1130060irmuunInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
79 ms9800 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,q; cin>>n>>q; set<int>st; int ans=0; for(int i=1;i<=q;i++){ int x; cin>>x; if(x>0){ if(st.count(x)==0){ st.insert(x); } else{ ans++; st.clear(); st.insert(x); } } else{ x=-x; if(st.count(x)==1){ st.erase(x); } } } 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...