Submission #1194948

#TimeUsernameProblemLanguageResultExecution timeMemory
1194948badge881Infinite Race (EGOI24_infiniterace2)C++20
100 / 100
70 ms9800 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, q; scanf("%d %d", &n, &q); set<int> s; int ans = 0; for (int i = 0; i < q; i++) { int x; scanf("%d", &x); if (x > 0) if (s.count(x)) { ans++; s.clear(); s.insert(x); } else s.insert(x); else s.erase(-x); } printf("%d\n", ans); }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...