Submission #1070330

#TimeUsernameProblemLanguageResultExecution timeMemory
1070330raduvInfinite Race (EGOI24_infiniterace2)C++14
100 / 100
97 ms10952 KiB
#include <bits/stdc++.h> using namespace std; set <int> s; int main() { int n, q, i, x, ans = 0; cin >> n >> q; while(q--){ cin >> x; if(x < 0){ s.erase(-x); } else{ if(s.find(x) != s.end()){ ans++; s.clear(); } s.insert(x); } } cout << ans << "\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:7:15: warning: unused variable 'i' [-Wunused-variable]
    7 |     int n, q, i, x, ans = 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...