제출 #1136216

#제출 시각아이디문제언어결과실행 시간메모리
1136216yoshiInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
66 ms9796 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void uwu(){
    ll n,q;
    cin>>n>>q;
    set<ll> a;
    ll ans=0;
    for(ll i=0; i<q; i++){
        ll x;
        cin>>x;
        if(x>0){
            if(a.count(x)==0){
                a.insert(x);
            }else{
                a.clear();
                a.insert(x);
                ans++;
            }
        }else{
            if(a.count(-x)==1) a.erase(-x);
        }
    }
    cout<<ans<<"\n";
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll t=1;
    //cin>>t;
    while(t--){
        uwu();
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…