Submission #1078329

#TimeUsernameProblemLanguageResultExecution timeMemory
1078329horiaboeriuInfinite Race (EGOI24_infiniterace2)C++17
100 / 100
26 ms2456 KiB
#include <stdio.h> #include <stdlib.h> #define MAXN 200000 int f[MAXN];//in f[x] este 0 daca x este in fata si 1 daca ea este in fata pe teren int main() { int n, q, i, x, rez, ul; scanf("%d%d", &n, &q); rez = 0; ul = 1; for (i = 1; i <= q; i++) { scanf("%d", &x); if (x < 0) { f[-x] = 0; } else { if (f[x] >= ul) { rez++; //acum il intrece doar pe x, deci da o tura intreaga si restul din fata ei raman in fata si cele din spate dupa ce face tura vor ajunge in fata ul = i; } f[x] = i; } } printf("%d\n", rez); return 0; }

Compilation message (stderr)

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