제출 #1065333

#제출 시각아이디문제언어결과실행 시간메모리
1065333Dan4LifeInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
79 ms11200 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    int n, q, ans = 0; cin >> n >> q;
    unordered_map<int,int> overtake;
    while(q--){
        int x; cin >> x;
        int X = abs(x);
        
        if(x>0 and overtake[X]==1)
            ans++, overtake.clear(), overtake[X]=1;
        else overtake[X]=(x>0)?1:-1;
    }
    cout << ans << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...