# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1049291 | sleepntsheep | Infinite Race (EGOI24_infiniterace2) | C11 | 20 ms | 2000 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>
int sgn(int x) {
return x < 0 ? -1 : x > 0 ? 1 : 0;
}
int main() {
int n, q, z = 1;
scanf("%d%d", &n, &q);
static int f[200000] = { 0 }, lap[200000] = { 0 };
for (int x, y, i = 1; i <= q; ++i) {
scanf("%d", &x);
y = x * sgn(x);
if (lap[y] != z) f[y] = 0;
if (sgn(x) == -1) {
f[y] = -1;
lap[y] = z;
} else {
if (f[y] == 1)
++z;
lap[y] = z;
f[y] = 1;
}
}
printf("%d\n", z - 1);
}
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... |