제출 #1237511

#제출 시각아이디문제언어결과실행 시간메모리
1237511User918Infinite Race (EGOI24_infiniterace2)C++20
100 / 100
78 ms12920 KiB
#include <bits/stdc++.h> #define ft first #define sd second #define pb push_back #define nl "\n" #define int long long typedef long long ll; typedef long double ld; using namespace std; const int N = 100100; const int mod = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, q; cin >> n >> q; map<int, int> v; int k = 0; while(q--) { int x; cin >> x; if (x > 0) { if (v[x] == 1) { k += 1; v.clear(); } v[x] += 1; } else { v[-x] = max(0ll, v[-x] - 1); } } cout << k; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...