# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
930510 | sleepntsheep | XORanges (eJOI19_xoranges) | C++17 | 97 ms | 10324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |