답안 #634303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634303 2022-08-24T08:47:40 Z smartmonky XORanges (eJOI19_xoranges) C++14
75 / 100
330 ms 11092 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <set>
#include <map>
 
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define int ll
using namespace std;
const int N=1e6;
int p[2][N];
main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int n,q;
    cin >> n>>q;
    vector <int> v(n+1);
    for(int i=1;i<=n;i++){
		cin >>v[i];
		p[i%2][i]=v[i];
		p[0][i]^=p[0][i-1];
		p[1][i]^=p[1][i-1];
	}
	if(n<=5e3 && q<=5e3){
		while(q--){
			int type,x,y;
			cin >>type >>x >>y;
			if(type==1)
				v[x]=y;
			else{
					int res=0;
					if((y-x)%2)
						cout<<0 <<endl;
					else{
						for(int i=x;i<=y;i+=2)
							res^=v[i];
						cout <<res <<endl;
					}
			}
		}
	}else{
		while(q--){
			int type,x,y;
			cin >>type >>x >>y;
			if(type==1)
				v[x]=y;
			else{
					if((y-x)%2)
						cout<<0 <<endl;
					else{
						cout<<(p[x%2][y]^p[x%2][x-1]) <<endl;
					}
			}
		}
	}
}

Compilation message

xoranges.cpp:17:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   17 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 6 ms 500 KB Output is correct
13 Correct 12 ms 496 KB Output is correct
14 Correct 13 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 11048 KB Output is correct
2 Correct 306 ms 11024 KB Output is correct
3 Correct 309 ms 11092 KB Output is correct
4 Correct 299 ms 10696 KB Output is correct
5 Correct 316 ms 10692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 6 ms 500 KB Output is correct
13 Correct 12 ms 496 KB Output is correct
14 Correct 13 ms 492 KB Output is correct
15 Correct 330 ms 11048 KB Output is correct
16 Correct 306 ms 11024 KB Output is correct
17 Correct 309 ms 11092 KB Output is correct
18 Correct 299 ms 10696 KB Output is correct
19 Correct 316 ms 10692 KB Output is correct
20 Incorrect 192 ms 10788 KB Output isn't correct
21 Halted 0 ms 0 KB -