답안 #929239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
929239 2024-02-18T04:10:27 Z bambaa XORanges (eJOI19_xoranges) C++14
75 / 100
441 ms 7576 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;} else {
		 			int p = ((b[z - 1] ^ b[y - 1]) ^ a[y - 1]);
		 			cout << p << endl;
		 		}
		 	}
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 8 ms 448 KB Output is correct
12 Correct 8 ms 452 KB Output is correct
13 Correct 12 ms 348 KB Output is correct
14 Correct 15 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 404 ms 3128 KB Output is correct
2 Correct 441 ms 3000 KB Output is correct
3 Correct 401 ms 3036 KB Output is correct
4 Correct 390 ms 3108 KB Output is correct
5 Correct 387 ms 3172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 8 ms 448 KB Output is correct
12 Correct 8 ms 452 KB Output is correct
13 Correct 12 ms 348 KB Output is correct
14 Correct 15 ms 348 KB Output is correct
15 Correct 404 ms 3128 KB Output is correct
16 Correct 441 ms 3000 KB Output is correct
17 Correct 401 ms 3036 KB Output is correct
18 Correct 390 ms 3108 KB Output is correct
19 Correct 387 ms 3172 KB Output is correct
20 Incorrect 312 ms 7576 KB Output isn't correct
21 Halted 0 ms 0 KB -