Submission #929238

# Submission time Handle Problem Language Result Execution time Memory
929238 2024-02-18T04:08:22 Z bambaa XORanges (eJOI19_xoranges) C++14
20 / 100
438 ms 8016 KB
//#include <bits/stdc++.h>
#include <iostream>
#include <set>
#include <cmath>
#include <iterator>
#include <vector>
 
#define ff first
#define ss second
#define mp make_pair 
#define ll long long
 
using namespace std;
int main() {

	int n, q;
	cin >> n >> q;
	int a[n];
	for (int i = 0; i < n; i++){
	 	cin >> a[i];
	}
	if (n <= 5000 && q <= 5000){
		for (int lol = 0; lol < q; lol++){
			int x, y, z;
		 	cin >> x >> y >> z;
		 	if (x == 1) {a[y - 1] = z;}
		 	else {
		 		if (z - y % 2 == 1) {cout << "0" << endl; continue;}
		 		int p = a[y - 1];
		 		for (int i = y + 1; i < z; i = i + 2){
		 			p = (p ^ a[i]);
		 		}
		 		cout << p << endl;
		 	}
		}
	} else {
		int b[n];
		b[0] = a[0];   b[1] = b[1];
		for (int i = 2; i < n; i++){
			b[i] = (b[i - 2] ^ a[i]);
		}
		for (int lol = 0; lol < q; lol++){
			int x, y, z;
		 	cin >> x >> y >> z;
		 	if (x == 1) {a[y - 1] = z;}
		 	else {
		 		if ((z - y) % 2 == 1) {cout << "0" << endl; continue;}
		 		int p = ((b[z - 1] ^ b[y - 1]) ^ a[y - 1]);
		 		cout << p << endl;
		 	}
		}
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 415 ms 3044 KB Output is correct
2 Correct 438 ms 7828 KB Output is correct
3 Correct 419 ms 8016 KB Output is correct
4 Correct 391 ms 7656 KB Output is correct
5 Correct 416 ms 7616 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -