Submission #638712

#TimeUsernameProblemLanguageResultExecution timeMemory
638712SalihSahinXORanges (eJOI19_xoranges)C++17
55 / 100
1084 ms6680 KiB
#include <bits/stdc++.h> #define pb push_back #define fastio cin.tie(0); ios_base::sync_with_stdio(false); cout.tie(0) #define endl "\n" #define all(v) v.begin(),v.end() #define int long long using namespace std; const int INF = 1e17, MOD = 1e9 + 7, N = 6e5 + 5, MOD2 = 998244353; int fpow(int a, int b){ // returns a to the power of b %MOD if(b == 0) return 1; if(b == 1) return a; int x = fpow(a,b/2)%MOD; if(b%2) return ((x*x)%MOD*a)%MOD; else return (x*x)%MOD; } int32_t main(){ fastio; int n, q; cin>>n>>q; vector<int> a(n + 1); for(int i = 1; i <= n; i++){ cin>>a[i]; } while(q--){ int type; cin>>type; if(type == 1){ int ind, x; cin>>ind>>x; a[ind] = x; } else{ // type == 2 int l, u; cin>>l>>u; if((u - l + 1)&1){ int res = 0; for(int start = l; start <= u; start += 2){ res ^= a[start]; } cout<<res<<endl; } else{ cout<<0<<endl; } } } 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...