제출 #1173271

#제출 시각아이디문제언어결과실행 시간메모리
1173271jiahcInfinite Race (EGOI24_infiniterace2)C++20
100 / 100
23 ms1204 KiB
#include <bits/stdc++.h> using namespace std; int n, q, a[200010]; int main() { scanf("%d%d", &n, &q); for (int i = 1; i <= n; i++) a[i] = -1; int ans = 0; while(q--) { int x; scanf("%d", &x); if (x > 0) { //a[x]++; if (a[x] == ans) { a[x]++; ans++; } else { a[x] = ans; } } else if (a[-x] >= 0) { a[-x]--; } } //int ans = 0; //for (int i = 1; i <= n; i++) { // if (a[i] >= 1) ans = max(ans, a[i] - 1); //} printf("%d\n", ans); return 0; }

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

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