| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1355868 | yyc000123 | Infinite Race (EGOI24_infiniterace2) | C++20 | 39 ms | 10432 KiB |
#include<bits/stdc++.h>
using namespace std ;
const int N = 2e5+5 ;
const int Q = 2e5+5 ;
int n , q , x , arr[N] , last , ans ;
set<int> st ;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) ;
cin >> n >> q ;
while(q--){
cin >> x ;
if(x<0){
if(st.find(-x)!=st.end()) st.erase(-x) , arr[-x]=0 ;
}
else if(arr[x]==0){
st.insert(x) ; arr[x]=1 ;
}
else{
if(st.find(x)!=st.end()) ans++ ;
st.clear() ;
st.insert(x) ;
}
}
cout << ans << '\n' ;
return 0 ;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
