# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078311 | horiaboeriu | Infinite Race (EGOI24_infiniterace2) | C++17 | 258 ms | 2008 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#define MAXN 200000
char f[MAXN];//in f[x] este 0 daca x este in fata si 1 daca ea este in fata pe teren
int rez[MAXN];
int main()
{
int n, q, i, x, rez, j;
scanf("%d%d", &n, &q);
rez = 0;
for (i = 0; i < q; i++) {
scanf("%d", &x);
if (x < 0) {
f[-x] = 0;
} else {
if (f[x] > 0) {
rez++;
//acum este in spatele tutror, mai putin a lui x
for (j = 0; j < n; j++) {
f[j] = 0;
}
}
f[x] = 1;
}
}
printf("%d\n", rez);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |