제출 #1210038

#제출 시각아이디문제언어결과실행 시간메모리
1210038sunflowerXORanges (eJOI19_xoranges)C++17
30 / 100
1096 ms1964 KiB
#include <bits/stdc++.h> using namespace std; int n, q; #define MAX_N 200'200 int a[MAX_N + 7], pre[MAX_N + 7]; #undef MAX_N int main() { ios_base::sync_with_stdio(false);cin.tie(nullptr); // freopen("test.inp","r",stdin); // freopen("test.out","w",stdout); cin >> n >> q; for (int i = 1; i <= n; ++i) cin >> a[i]; pre[0] = 0; for (int i = 1; i <= n; ++i) pre[i] = pre[i - 1] ^ a[i]; while (q--) { int type; cin >> type; if (type == 1) { int pos, val; cin >> pos >> val; a[pos] = val; } else { int l, r; cin >> l >> r; pre[0] = 0; for (int i = 1; i <= n; ++i) pre[i] = pre[i - 1] ^ a[i]; int ans = 0; for (int len = 1; len <= r - l + 1; ++len) { for (int i = l; i + len - 1 <= r; ++i) { ans ^= pre[i + len - 1] ^ pre[i - 1]; } } cout << ans << "\n"; } } return 0; }
#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...