Submission #1078284

# Submission time Handle Problem Language Result Execution time Memory
1078284 2024-08-27T14:51:58 Z horiaboeriu Infinite Race (EGOI24_infiniterace2) C++17
29 / 100
17 ms 1808 KB
#include <stdio.h>
#include <stdlib.h>
#define MAXN 200000
char f[MAXN + 1];//in f[x] este 0 daca x este in fata si 1 daca ea este in fata(nu la numarul de ture, ci la cat a parcurs din traseu la turele sale)
int main()
{
    int n, q, i, rez, x, prx;
    scanf("%d%d", &n, &q);
    rez = prx = 0;
    for (i = 0; i < q; i++) {
        scanf("%d", &x);
        if (x < 0) {
            x = -x;
            f[x] = 0;
        } else {
            if (f[x] > 0) {
                if (prx == 0) {
                    prx = x;
                }
                rez += prx == x;
                prx = x;
            }
            f[x] = 1;
        }
    }
    printf("%d\n", rez);
    return 0;
}

Compilation message

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:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &x);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 11 ms 860 KB Output is correct
5 Correct 15 ms 860 KB Output is correct
6 Correct 11 ms 856 KB Output is correct
7 Correct 11 ms 688 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 10 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 9 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 12 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 11 ms 916 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 600 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 15 ms 600 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 15 ms 1808 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Incorrect 17 ms 604 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 11 ms 860 KB Output is correct
5 Correct 15 ms 860 KB Output is correct
6 Correct 11 ms 856 KB Output is correct
7 Correct 11 ms 688 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 10 ms 604 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 9 ms 860 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 12 ms 860 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 11 ms 916 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 10 ms 600 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 15 ms 600 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 15 ms 1808 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Incorrect 17 ms 604 KB Output isn't correct
28 Halted 0 ms 0 KB -