This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <unordered_set>
using namespace std;
#define ll long long
#define ff first
#define ss second
ll n, k, sum, m, s, f;
ll MOD = 1e9 + 7;
ll ttt;
ll a[200007];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int j = 0; j < k; j++) {
int id, c, d;
cin >> id >> c >> d;
if (id == 1) {
a[c] = d;
}
else {
map<ll, ll>cur;
unordered_set<ll>nw;
ll ans = 0;
for (int i = c; i <= d; i++) {
int f = i - c + 1;
int m = 2 * n - c - d - 1;
int x = min(f, m - f + 1);
cur[a[i]] += (x - 1) * x + (m - 2 * (x - 1)) * x;
nw.insert(a[i]);
//cout << a[i] << " " << cur[a[i]] << endl;
}
for (auto i : nw) {
if (cur[i] % 2 != 0) {
ans = ans ^ i;
}
}
cout << ans << endl;
}
}
return 0;
}
# | 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... |