제출 #1234246

#제출 시각아이디문제언어결과실행 시간메모리
1234246badge881가로등 (APIO19_street_lamps)C++20
20 / 100
5095 ms4424 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 11; int n, q; int a[N][N]; char chr; int main() { scanf("%d%d\n", &n, &q); for (int i = 1; i <= n; i++) { scanf("%c", &chr); a[i][0] = chr - '0'; } for (int t = 1; t <= q; t++) { char str[10]; scanf("\n%s ", str); for (int i = 1; i <= n; i++) a[i][t] = a[i][t - 1]; if (str[0] == 't') // supposing there is no output starting by t other than toggle { int p; scanf("%d\n", &p); a[p][t] ^= 1; } else { int l, r, ans = 0; scanf("%d%d\n", &l, &r); for (int i = 0; i < t; i++) { bool ok = 1; for (int j = l; j < r; j++) ok &= a[j][i]; ans += ok; } printf("%d\n", ans); } } }

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

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%d%d\n", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
street_lamps.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |         scanf("%c", &chr);
      |         ~~~~~^~~~~~~~~~~~
street_lamps.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         scanf("\n%s ", str);
      |         ~~~~~^~~~~~~~~~~~~~
street_lamps.cpp:29:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |             scanf("%d\n", &p);
      |             ~~~~~^~~~~~~~~~~~
street_lamps.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |             scanf("%d%d\n", &l, &r);
      |             ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...