Submission #1237507

#TimeUsernameProblemLanguageResultExecution timeMemory
1237507User918Infinite Race (EGOI24_infiniterace2)C++20
0 / 100
10 ms1864 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; vector<int> v(n, 0); int k = 0; while(q--) { int x; cin >> x; if (x > 0) { if (v[x] > k) { k += 1; } 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...