Submission #1148205

#TimeUsernameProblemLanguageResultExecution timeMemory
1148205AbdullahIshfaqInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
88 ms12872 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 998244353 void solve(){ ll n, q, ans = 0, x; cin >> n >> q; map<ll,ll> mp; for(int i = 0; i < q; i ++){ cin >> x; if(x > 0){ if(mp.find(x) != mp.end() and mp[x] == ans){ ans++; } mp[x] = ans; } else{ if(mp.find(-x) != mp.end()){ mp.extract(-x); } } } cout << ans << '\n'; } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int tests = 1; // cin >> tests; for(int i = 1; i <= tests; i ++) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...