제출 #1241051

#제출 시각아이디문제언어결과실행 시간메모리
1241051azamuraiXORanges (eJOI19_xoranges)C++20
55 / 100
1096 ms2064 KiB
#include <bits/stdc++.h> #define int long long #define fi first #define se second #define Sz(x) (int)x.size() #define mp make_pair using namespace std; typedef long long ll; const int N = 2e5 + 5; int n, q, a[N]; void solve() { cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> a[i]; } while (q--) { int tp; cin >> tp; if (tp == 1) { int ind, val; cin >> ind >> val; a[ind] = val; } else { int l, r; cin >> l >> r; int ans = 0; for (int i = l; i <= r; i++) { int k = (r - l + 1); int R = min(i-l+1,r-i+1), cnt = 0; if (k % 2 == 0) cnt = (R * (R + 1)) + R * (k - 2 * R); else { if (R == (k + 1) / 2) cnt = R * R; else cnt = (R * (R + 1)) + R * (k - 2 * R); } if (cnt % 2 == 1) ans ^= a[i]; } cout << ans << '\n'; } } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; //cin >> t; while ( t-- ) { solve(); cout << '\n'; } }
#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...