This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//don't copy pls)
/*TAAK ZDES NADO RECURSIU PISAT*/
//I'm not in the danger i am the DANGER
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define sigma signed
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,q,a[N],p[N];
void Gold(){
cin >> n >> q;
for(int i = 1 ; i <= n ; i++){
cin >> a[i];
p[i] = p[i - 1] ^ a[i];
}
while(q--){
int tp;
cin >> tp;
if(tp == 1){
int x,y;
cin >> x >> y;
a[x] = y;
for(int i = 1 ; i <= n ; i++){
p[i] = p[i - 1] ^ a[i];
}
}
else{
int l,r;
cin >> l >> r;
int x = 0;
map <int,int> mp;
for(int j = 1 ; j <= r - l + 1 ; j++){
for(int i = l + j - 1 ; i <= r ; i++){
x ^= (p[i] ^ p[i - j]);
}
}
cout << x << '\n';
}
}
}
sigma main(){
//freopen("txt.in","r",stdin);
//freopen("txt.out","w",stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
srand(time(0));
int TT = 1;
// cin >> TT;
for(int i = 1 ; i <= TT ; i++){
//cout << "Case " << i << ": ";
Gold();
}
}
# | 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... |