제출 #1221077

#제출 시각아이디문제언어결과실행 시간메모리
1221077RifalInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
66 ms9800 KiB
#include <bits/stdc++.h> #include <fstream> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define endl '\n' #define pb push_back #define INF 200000000 #define fi first #define se second //#define cin fin //#define cout fout using namespace std; //double const EPS = 1e-14; typedef long long ll; //const ll P = 10007; //const ll mod = 1e9 + 7; //using namespace __gnu_pbds; //typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); int n, q; cin >> n >> q; set<int> st; int ans = 0; while(q--) { int x; cin >> x; if(x > 0) { if(st.find(x) != st.end()) { ans++; st.clear(); } st.insert(x); } else { x *= -1; if(st.find(x) != st.end()) st.erase(x); } } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...