제출 #703244

#제출 시각아이디문제언어결과실행 시간메모리
703244rainboyXORanges (eJOI19_xoranges)C11
100 / 100
126 ms8628 KiB
#include <stdio.h> #define N 200000 void update(int *ft, int i, int n, int x) { while (i < n) { ft[i] ^= x; i |= i + 1; } } int query(int *ft, int i) { int x = 0; while (i >= 0) { x ^= ft[i]; i &= i + 1, i--; } return x; } int main() { static int aa[N], ft[2][N]; int n, q, i; scanf("%d%d", &n, &q); for (i = 0; i < n; i++) { scanf("%d", &aa[i]); update(ft[i % 2], i, n, aa[i]); } while (q--) { int t, a, l, r; scanf("%d", &t); if (t == 1) { scanf("%d%d", &i, &a), i--; update(ft[i % 2], i, n, aa[i] ^ a); aa[i] = a; } else { scanf("%d%d", &l, &r), l--, r--; printf("%d\n", (r - l) % 2 != 0 ? 0 : query(ft[l % 2], r) ^ query(ft[l % 2], l - 1)); } } return 0; }

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

xoranges.c: In function 'main':
xoranges.c:26:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
xoranges.c:28:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
xoranges.c:34:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |   scanf("%d", &t);
      |   ^~~~~~~~~~~~~~~
xoranges.c:36:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |    scanf("%d%d", &i, &a), i--;
      |    ^~~~~~~~~~~~~~~~~~~~~
xoranges.c:40:4: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |    scanf("%d%d", &l, &r), 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...