Submission #1070443

#TimeUsernameProblemLanguageResultExecution timeMemory
1070443matthewInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
69 ms11028 KiB
#include <stdio.h> #include <set> const int MAXN = 200'000; std::set<int> spate; // cine e in spatele meu void solveTest() { int n, q, i, rez, a; scanf("%d%d", &n, &q); rez = 0; for(i = 0; i < q; i++) { scanf("%d", &a); if(a > 0) { if(spate.find(a) != spate.end()) { // am facut o tura rez++; // ne cere nr minim de ture deci worst case toti vor fi in fata // mai putin asta pe care l-am intrecut spate.clear(); } spate.insert(a); } else { spate.erase(-a); } } printf("%d\n", rez); } int main() { int t, i; #ifdef LOCAL freopen("input.txt", "r", stdin); #endif t = 1; //scanf("%d", &t); for(i = 0; i < t; i++) { #ifdef LOCAL printf("====== Test %d ======\n", i + 1); #endif solveTest(); #ifdef LOCAL printf("\n\n"); #endif } return 0; }

Compilation message (stderr)

Main.cpp: In function 'void solveTest()':
Main.cpp:11:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   scanf("%d%d", &n, &q);
      |   ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     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...