답안 #524569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524569 2022-02-09T14:13:15 Z fadi57 XORanges (eJOI19_xoranges) C++14
100 / 100
694 ms 15256 KB
#include<bits/stdc++.h>
using namespace std;
const int mx=2e5+9;
typedef long long ll;
const int mod=1000000007;
const long long inf=1e18+10;
const int SQ=450;
vector<vector<int>>v;
  int seg[4*mx][4];


         void update(int node,int st,int en,int idx,int value){
           if(st==en){
                seg[node][1]=(st%2)*value;
             seg[node][0]=(1-(st%2))*value;
             return;
            }
           int mid=(st+en)/2;

           if(idx>mid){
            update(node*2+1,mid+1,en,idx,value);
           }else{

            update(node*2,st,mid,idx,value);
           }
           seg[node][0]=seg[node*2][0]^seg[node*2+1][0];
           seg[node][1]=seg[node*2][1]^seg[node*2+1][1];
           return ;
         }

         int query(int node,int st,int en,int l,int r){
               if(st>=l&&en<=r){
                   return seg[node][l%2];


               }
               if(st>r||en<l){return 0;}
               int mid=(st+en)/2;
               return query(node*2,st,mid,l,r)^query(node*2+1,mid+1,en,l,r);

        }


    int main(){


        int n,q;
        cin>>n>>q;
        int a[n+5];
        for(int i=1;i<=n;i++){
            cin>>a[i];
            update(1,1,n,i,a[i]);

        }
      //  cout<<seg[2][1];
        while(q--){
            int t,x,y;
            cin>>t>>x>>y;

            if(t==1){
              update(1,1,n,x,y);

            }else{
                int sz=(y-x+1)%2;

                cout<<sz*query(1,1,n,x,y)<<"\n";
             }


        }

     }

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 11 ms 588 KB Output is correct
12 Correct 13 ms 692 KB Output is correct
13 Correct 14 ms 808 KB Output is correct
14 Correct 12 ms 704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 694 ms 15256 KB Output is correct
2 Correct 620 ms 15248 KB Output is correct
3 Correct 571 ms 15216 KB Output is correct
4 Correct 555 ms 14952 KB Output is correct
5 Correct 608 ms 14964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 11 ms 588 KB Output is correct
12 Correct 13 ms 692 KB Output is correct
13 Correct 14 ms 808 KB Output is correct
14 Correct 12 ms 704 KB Output is correct
15 Correct 694 ms 15256 KB Output is correct
16 Correct 620 ms 15248 KB Output is correct
17 Correct 571 ms 15216 KB Output is correct
18 Correct 555 ms 14952 KB Output is correct
19 Correct 608 ms 14964 KB Output is correct
20 Correct 442 ms 15040 KB Output is correct
21 Correct 445 ms 15244 KB Output is correct
22 Correct 456 ms 14948 KB Output is correct
23 Correct 550 ms 14844 KB Output is correct
24 Correct 532 ms 14848 KB Output is correct