답안 #1080008

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080008 2024-08-29T06:03:49 Z timoni XORanges (eJOI19_xoranges) C++17
55 / 100
1000 ms 8592 KB
//don't copy pls)
/*TAAK ZDES NADO RECURSIU PISAT*/

//I'm not in the danger i am the DANGER
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int,int>
#define sigma signed
using namespace std;
using namespace __gnu_pbds;
const int N = 3e5 + 5;
int mod = 1e9 + 7;
const int INF = 1e18;
int n,q,a[N],p[N],ans[N];
void Gold(){
	cin >> n >> q;
	for(int i = 1 ; i <= n ; i++){
		cin >> a[i];
		p[i] = p[i - 1] ^ a[i];
	}
	while(q--){
		int tp;
		cin >> tp;
		if(tp == 1){
			int x,y;
			cin >> x >> y;
			a[x] = y;
			for(int i = 1 ; i <= n ; i++){
				p[i] = p[i - 1] ^ a[i];
			}
		}
		else{
			int l,r;
			cin >> l >> r;
			int x = 0;
			map <int,int> mp;
			for(int i = l ; i <= r ; i++){
				ans[i] = 0;
			}
			// for(int j = 1 ; j <= r - l + 1 ; j++){
				// for(int i = l + j - 1 ; i <= r ; i++){
					// x ^= (p[i] ^ p[i - j]);
					// for(int k = i - j + 1 ; k <= i ; k++){
						// mp[a[k]]++;
					// }
				// }
			// }
			// for(auto it : mp){
				// cout << it.F << ' ' << it.S << '\n';
			// }
			ans[l] = r - l + 1; 
			int cur = 2;
			for(int i = l + 1 ; i <= r ; i++){
				ans[i] = ans[i - 1] + ((r - l + 1) - cur);
				cur += 2;
			}
			for(int i = l ; i <= r ; i++){
				if(ans[i] % 2){
					x ^= a[i];
				}
			}
			cout << x << '\n';
		}
	}
}
sigma main(){
	//freopen("txt.in","r",stdin);
	//freopen("txt.out","w",stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	srand(time(0));
	int TT = 1;
	// cin >> TT;
	for(int i = 1 ; i <= TT ; i++){
		//cout << "Case " << i << ": ";
		Gold();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2548 KB Output is correct
11 Correct 17 ms 2648 KB Output is correct
12 Correct 16 ms 2652 KB Output is correct
13 Correct 34 ms 2708 KB Output is correct
14 Correct 35 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1034 ms 8592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2548 KB Output is correct
11 Correct 17 ms 2648 KB Output is correct
12 Correct 16 ms 2652 KB Output is correct
13 Correct 34 ms 2708 KB Output is correct
14 Correct 35 ms 2652 KB Output is correct
15 Execution timed out 1034 ms 8592 KB Time limit exceeded
16 Halted 0 ms 0 KB -