제출 #930510

#제출 시각아이디문제언어결과실행 시간메모리
930510sleepntsheepXORanges (eJOI19_xoranges)C++17
100 / 100
97 ms10324 KiB
#include <stdio.h> #define N 200000 int n, q; struct st { int t[N<<1]; void upd(int p, int k) { for (t[p += n] = k; p >>= 1;) t[p] = t[p<<1] ^ t[p<<1|1]; } int qry(int l, int r) { int z = 0; for (l += n, r += n; l < r; l >>= 1, r >>= 1) { if (l&1) z ^= t[l++]; if (r&1) z ^= t[--r]; } return z; } } t[2]; int a[N]; int main() { scanf("%d%d", &n, &q); for (int i = 0; i < n; ++i) scanf("%d", a+i), t[i&1].upd(i, a[i]); for (int op, x, y; q--;) { scanf("%d%d%d", &op, &x, &y); switch (op) { case 1: --x; t[x&1].upd(x, y); break; default: --x, --y; if ((y - x) & 1) { puts("0"); } else { printf("%d\n", t[x&1].qry(x, y+1)); } break; } } return 0; }

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

xoranges.cpp: In function 'int main()':
xoranges.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d%d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~
xoranges.cpp:32:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     for (int i = 0; i < n; ++i) scanf("%d", a+i), t[i&1].upd(i, a[i]);
      |                                 ~~~~~^~~~~~~~~~~
xoranges.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |         scanf("%d%d%d", &op, &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#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...