답안 #464336

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
464336 2021-08-13T03:31:00 Z Kerim XORanges (eJOI19_xoranges) C++17
100 / 100
136 ms 8396 KB
#include "bits/stdc++.h"
#define MAXN 200009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;
 
typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
int arr[MAXN];
struct bit{
	int F[MAXN];
	int get(int x){
		int res=0;
		for(;x;x-=x&(-x))
			res^=F[x];
		return res;
	}
	void upd(int x,int v){
		for(;x<MAXN;x+=x&(-x))
			F[x]^=v;
	}
}s[2];
int main(){
    //~ freopen("file.in", "r", stdin);
    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++){
		scanf("%d",arr+i);
		s[i&1].upd(i,arr[i]);
	}
	while(q--){
		int t,x,y;
		scanf("%d%d%d",&t,&x,&y);
		if(t==2){
			if(y%2!=x%2)puts("0");
			else printf("%d\n",s[y&1].get(y)^s[y&1].get(x-1));
		}
		else
			s[x&1].upd(x,y^arr[x]),arr[x]=y;
	}
	return 0;
}

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:37:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |     scanf("%d%d",&n,&q);
      |     ~~~~~^~~~~~~~~~~~~~
xoranges.cpp:39:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |   scanf("%d",arr+i);
      |   ~~~~~^~~~~~~~~~~~
xoranges.cpp:44:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |   scanf("%d%d%d",&t,&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 3 ms 460 KB Output is correct
13 Correct 3 ms 460 KB Output is correct
14 Correct 3 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 3768 KB Output is correct
2 Correct 136 ms 3772 KB Output is correct
3 Correct 116 ms 3780 KB Output is correct
4 Correct 107 ms 3772 KB Output is correct
5 Correct 117 ms 3844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 368 KB Output is correct
11 Correct 3 ms 460 KB Output is correct
12 Correct 3 ms 460 KB Output is correct
13 Correct 3 ms 460 KB Output is correct
14 Correct 3 ms 460 KB Output is correct
15 Correct 117 ms 3768 KB Output is correct
16 Correct 136 ms 3772 KB Output is correct
17 Correct 116 ms 3780 KB Output is correct
18 Correct 107 ms 3772 KB Output is correct
19 Correct 117 ms 3844 KB Output is correct
20 Correct 131 ms 8396 KB Output is correct
21 Correct 124 ms 8392 KB Output is correct
22 Correct 112 ms 8348 KB Output is correct
23 Correct 116 ms 8260 KB Output is correct
24 Correct 107 ms 8292 KB Output is correct