제출 #1078297

#제출 시각아이디문제언어결과실행 시간메모리
1078297horiaboeriuInfinite Race (EGOI24_infiniterace2)C++17
29 / 100
21 ms1844 KiB
#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;
    scanf("%d%d", &n, &q);
    for (i = 0; i < q; i++) {
        scanf("%d", &x);
        if (x < 0) {
            f[-x] = 0;
        } else {
            if (f[x] > 0) {
                rez[x]++;
            }
            f[x] = 1;
        }
    }
    x = 0;
    for (i = 1; i < n; i++) {
        if (rez[i] > x) {
            x = rez[i];
        }
    }
    printf("%d\n", x);
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...