제출 #1128571

#제출 시각아이디문제언어결과실행 시간메모리
1128571Ak_16Infinite Race (EGOI24_infiniterace2)C++17
100 / 100
106 ms10808 KiB
#include <iostream> #include <set> using namespace std; int main() { int n,q; int a[300000]; int cnt=0; set<int> s; cin>>n; cin>>q; int f[300000] = {0}; for(int i=1; i<=q; i++){cin>>a[i];} for(int i=1; i<=q; i++){ if(a[i]>0){ if(s.find(a[i]) == s.end()){ s.insert(a[i]); } else { cnt++; s.clear(); s.insert(a[i]); } } else { s.erase(-a[i]); } } cout<<cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...