#include<bits/stdc++.h>
#pragma optimize ("g",on)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
using namespace std;
#define all(a) a.begin(), a.end()
#define ll long long
#define pb push_back
#define nl '\n'
#define popb pop_back()
#define sz size()
#define ld long double
#define ull unsigned long long
#define F first
#define S second
#define fix fixed << setprecision
#define pii pair<int, int>
#define E exit (0)
#define int long long
const int inf = (1ll << 62ll), N = 1e5 + 1, mod = 998244353;
vector<pii> dd = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
signed main() {
//freopen("invtrans.in", "r", stdin);
//freopen("invtrans.out", "w", stdout);
ios_base::sync_with_stdio(NULL);
cin.tie(NULL);
int n, q;
cin >> n >> q;
int a[n + 1];
for (int i = 1; i <= n; i++) cin >> a[i];
while (q--) {
int tp;
cin >> tp;
if (tp == 1) {
int i, j;
cin >> i >> j;
a[i] = j;
}else {
int l, r;
cin >> l >> r;
int ans = 0;
for (int i = l; i <= r; i++) {
int x = 0;
for (int j = i; j <= r; j++) {
x ^= a[j];
ans ^= x;
}
}
cout << ans << nl;
}
}
}
Compilation message
xoranges.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
3 | #pragma optimize ("g",on)
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
204 KB |
Output is correct |
2 |
Correct |
5 ms |
204 KB |
Output is correct |
3 |
Correct |
6 ms |
328 KB |
Output is correct |
4 |
Correct |
27 ms |
328 KB |
Output is correct |
5 |
Correct |
24 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
312 KB |
Output is correct |
6 |
Correct |
6 ms |
204 KB |
Output is correct |
7 |
Correct |
5 ms |
204 KB |
Output is correct |
8 |
Correct |
6 ms |
328 KB |
Output is correct |
9 |
Correct |
27 ms |
328 KB |
Output is correct |
10 |
Correct |
24 ms |
324 KB |
Output is correct |
11 |
Execution timed out |
1090 ms |
460 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
1868 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
312 KB |
Output is correct |
6 |
Correct |
6 ms |
204 KB |
Output is correct |
7 |
Correct |
5 ms |
204 KB |
Output is correct |
8 |
Correct |
6 ms |
328 KB |
Output is correct |
9 |
Correct |
27 ms |
328 KB |
Output is correct |
10 |
Correct |
24 ms |
324 KB |
Output is correct |
11 |
Execution timed out |
1090 ms |
460 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |