Submission #1276254

#TimeUsernameProblemLanguageResultExecution timeMemory
1276254AlmontherInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
15 ms1996 KiB
#include<bits/stdc++.h>

#define ll long long
#define co cout<<

using namespace std;
// stuff

void solve(){
    ll n,q;
    cin>>n>>q;
    ll f[n+5]={},p=1;
    while(q--){
        ll x;
        cin>>x;
        if(x>0){
            p+=(f[x]==p);
            f[x]=p;
        }
        else{
            x=-x;
            f[x]=0;
        }
    }
    co p-1;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int _=1;
    // cin>>_;
    while(_--) solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...