이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stack>
using namespace std;
using ll = long long;
vector <int> v, anc;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, q, i, j, x, ans = 0, c,y;
cin >> n >> q;
for ( i = 0; i < n; i++)
{
cin >> x;
v.push_back(x);
}
ans = 0;
int g = 0;
for ( i = 0; i < q; i++)
{
cin >> c >> x >> y;
x--; y--;
if (c == 1)
{
g = 0;
v[x] = y + 1;
}
else
{
if (g)
cout << ans << endl;
else
{
int f = 0;
for (j = x; j <= y; j++)
{
if(((j - x + 1) * (y - j + 1))%2)
f = f ^ v[j];
}
ans = f;
g = 1;
cout << ans << '\n';
}
}
}
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... |