제출 #464492

#제출 시각아이디문제언어결과실행 시간메모리
464492ItamarXORanges (eJOI19_xoranges)C++14
0 / 100
671 ms4760 KiB
// oranges.cpp : This file contains the 'main' function. Program execution begins and ends there. // using namespace std; #include <iostream> #include <algorithm> #include <vector> vector<int> odd; vector<int> eve; vector<int> val; int n, q; void fun() { int xo = 0; for (int i = 0; i < n; i += 2) { xo = xo ^ val[i]; eve.push_back(xo); } xo = 0; for (int i = 1; i < n; i += 2) { xo = xo ^ val[i]; odd.push_back(xo); } } int main() { cin >> n; cin >> q; for (int i = 0; i < n; i++) { int x; cin >> x; val.push_back(x); } fun(); for (int i = 0; i < q; i++) { int a, b, c; cin >> a; cin >> b; cin >> c; if (a == 1) { val[b - 1] = c; fun(); } else { if ((b - c-1) % 2 == 0) { cout << 0 << endl; } else { if ((b - 1) % 2 == 0) { int x = (odd[(b - 2) / 2])^(odd[(c-2) / 2]); cout << x << endl; } else { int x = eve[(b - 2) / 2] ^ eve[(c-2) / 2]; cout << x << endl; } } } } }
#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...