Submission #1238593

#TimeUsernameProblemLanguageResultExecution timeMemory
1238593JerInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
72 ms10568 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; int laps[MAXN]; int n, q; int main() { scanf("%d%d", &n, &q); fill(laps, laps + n, 0); map<int, int> laps; int a, res = 0; while (q--) { scanf("%d", &a); if (a > 0) { if (laps[a] == 1) res++, laps.clear(); laps[a] += 1; } else laps[-a] = 0; } printf("%d\n", res); return 0; }

Compilation message (stderr)

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