| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 748601 | Desh03 | XORanges (eJOI19_xoranges) | C++17 | 122 ms | 8692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct fenwick {
vector<int> fenw;
int n;
fenwick(int n_) : n(n_) {
fenw.resize(n);
}
void upd(int u, int x) {
for (; u < n; u |= u + 1) fenw[u] ^= x;
}
int qry(int u) {
int xr = 0;
for (; u >= 0; u = (u & (u + 1)) - 1) xr ^= fenw[u];
return xr;
}
int qry(int l, int r) {
return qry(r) ^ qry(l - 1);
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, q;
cin >> n >> q;
vector<int> a(n);
fenwick bit1(n), bit2(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
if (i & 1) bit2.upd(i, a[i]);
else bit1.upd(i, a[i]);
}
while (q--) {
int t, l, u;
cin >> t >> l >> u;
if (t == 1) {
--l;
if (l & 1) bit2.upd(l, u ^ a[l]);
else bit1.upd(l, u ^ a[l]);
a[l] = u;
} else {
--l, --u;
if (u - l & 1) cout << "0\n";
else cout << (l & 1 ? bit2.qry(l, u) : bit1.qry(l, u)) << '\n';
}
}
}
컴파일 시 표준 에러 (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... | ||||
