Submission #746564

# Submission time Handle Problem Language Result Execution time Memory
746564 2023-05-22T19:29:11 Z Elvin_Fritl XORanges (eJOI19_xoranges) C++17
0 / 100
479 ms 6884 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main()
{
    int n,q;
    cin>>n>>q;
    vector<int>a(n+1),pre(n+1,0),pre2(n+1,0);

    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i&1){
            pre[i]=(pre[i-1]^a[i]);
            pre2[i]=pre2[i-1];
        }
        else{
            pre2[i]=(pre2[i-1]^a[i]);
            pre[i]=pre[i-1];
        }
    }

    while(q--){
        int ind,l,r;
        cin>>ind>>l>>r;
        if(ind==2){
            if(l&1){
                cout<<(pre[r]^pre[l-1])<<"\n";
            }
            else{
                cout<<(pre2[r]^pre2[l-1])<<"\n";
            }
        }
        else{
            a[l]=r;
            if(l&1){
                for(int i=l;i<=n;i++){
                    if(i&1){
                        pre[i]=(pre[i-1]^a[i]);
                    }
                    else{
                        pre[i]=pre[i-1];
                    }
                }
            }
            else{
                for(int i=l;i<=n;i++){
                    if(i&1){
                        pre2[i]=pre2[i-1];
                    }
                    else{
                        pre2[i]=(pre2[i-1]^a[i]);
                    }
                }
            }
        }
    }


    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 479 ms 6884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -