제출 #1117278

#제출 시각아이디문제언어결과실행 시간메모리
1117278thelegendary08Infinite Race (EGOI24_infiniterace2)C++17
100 / 100
68 ms11168 KiB
// Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> #define pb push_back #define int long long #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; signed main(){ ios::sync_with_stdio(false); cin.tie(NULL); //ifstream cin(".in"); //ofstream cout(".out"); int n; cin>>n; int q; cin>>q; //vi fb(n, -1); //vi ans(n, 0); int ans = 0; set<int>s; while(q--){ int x; cin>>x; if(x < 0){ s.erase(-x); } else{ if(s.count(x)){ ans++; s = set<int>(); } s.insert(x); } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...