제출 #382581

#제출 시각아이디문제언어결과실행 시간메모리
382581rainboy가로등 (APIO19_street_lamps)C11
20 / 100
1 ms364 KiB
#include <stdio.h> #define N 300000 #define Q 300000 #define S 100 int main() { static char cc[N + 1]; static int ll[S][S]; int n, q, h, h_, i; scanf("%d%d%s", &n, &q, cc); if (n <= 100 && q <= 100) { for (h = 0; h < q; h++) { static char s[8]; scanf("%s", s); for (i = 0; i < n; i++) ll[h][i] = cc[i] == '0' ? i + 1 : (i == 0 ? 0 : ll[h][i - 1]); if (s[0] == 't') { scanf("%d", &i), i--; cc[i] = (cc[i] - '0' ^ 1) + '0'; } else { int l, r, cnt; scanf("%d%d", &l, &r), l--, r -= 2; cnt = 0; for (h_ = 0; h_ <= h; h_++) if (ll[h_][r] <= l) cnt++; printf("%d\n", cnt); } } } return 0; }

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

street_lamps.c: In function 'main':
street_lamps.c:22:20: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   22 |     cc[i] = (cc[i] - '0' ^ 1) + '0';
      |              ~~~~~~^~~~~
street_lamps.c:12:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   12 |  scanf("%d%d%s", &n, &q, cc);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
street_lamps.c:17:4: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   17 |    scanf("%s", s);
      |    ^~~~~~~~~~~~~~
street_lamps.c:21:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   21 |     scanf("%d", &i), i--;
      |     ^~~~~~~~~~~~~~~
street_lamps.c:26:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   26 |     scanf("%d%d", &l, &r), l--, r -= 2;
      |     ^~~~~~~~~~~~~~~~~~~~~
#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...