Submission #464335

# Submission time Handle Problem Language Result Execution time Memory
464335 2021-08-13T03:29:01 Z Kerim XORanges (eJOI19_xoranges) C++17
38 / 100
121 ms 8668 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(y,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);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 118 ms 8668 KB Output is correct
2 Correct 121 ms 8624 KB Output is correct
3 Correct 119 ms 8648 KB Output is correct
4 Correct 108 ms 8312 KB Output is correct
5 Correct 114 ms 8384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -