| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1348767 | msb.83 | Infinite Race (EGOI24_infiniterace2) | C++20 | 0 ms | 344 KiB |
//Rahman ve Rahim olan Allah'ın adıyla
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ins insert
#define fi first
#define se second
#define int long long
#define mid (st+end)/2
#define spc <<" "<<
#define en <<"\n"
#define amin main
int32_t amin(){
ios_base::sync_with_stdio(false);cin.tie(0);
freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
int n,q,a;cin>>n>>q;vector<int>strk(n,0);vector<int>lstn(n,0);int ans=0,lst=0;
for(int i=0;i<q;i++){
cin>>a;
if(a<0){
if(strk[abs(a)]>0){
strk[abs(a)]=0;
}
//cout<<a<<"\n";
}else{
if(strk[abs(a)]<0){
strk[abs(a)]=0;
}if(strk[abs(a)]!=0&&lstn[abs(a)]<lst){strk[abs(a)]=0;}
strk[abs(a)]++;lstn[abs(a)]=i;//cout<<"ed"<<abs(a)<<strk[abs(a)]<<"\n";
if(strk[abs(a)]!=1){
ans++;lst=i;//cout<<i;
}
}
}
cout<<ans;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
