Submission #746563

# Submission time Handle Problem Language Result Execution time Memory
746563 2023-05-22T19:25:21 Z Elvin_Fritl XORanges (eJOI19_xoranges) C++17
0 / 100
549 ms 9400 KB
#include <bits/stdc++.h>

using namespace std;

int 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])<<endl;
            }
            else{
                cout<<(pre2[r]^pre2[l-1])<<endl;
            }
        }
        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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 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 549 ms 9400 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 -