Submission #1102716

# Submission time Handle Problem Language Result Execution time Memory
1102716 2024-10-18T18:02:35 Z _snoopy_ XORanges (eJOI19_xoranges) C++17
0 / 100
1000 ms 5228 KB
#include <bits/stdc++.h>
using namespace std;

long long int arr[1000010];
int main(){


    long long int n, q, i, j, k, a, b, c, x, d;
    cin>>n>>q;

    for(i=1; i<=n; i++){
        cin>>arr[i];
    }

    for(i=0; i<q; i++){
        cin>>a>>b>>c;

        if(a==1){
            arr[b]=c;
        }
        else{
            x=0;
            if((c-b+1)%2==0 ){
                x=x^0;
            }
            else if((c-b+1)==1){
                x=x^arr[b];
                cout<<x<<endl;
                continue;
            }
            else{
                x=x^arr[b];
            }
            for(j=b+1; j<c; j++){
                //cout<<"hello"<<endl;
                if(((c-b+1)+((c-b+1)-arr[j]))% 2==0){
                    x=x^0;
                }
                else{
                    x=x^arr[j];
                }
            }
            if((c-b+1)%2==0){
                x=x^0;
            }
            else{
                x=x^arr[c];
            }

            cout<<x<<endl;
        }
    }


    return 0;

}

Compilation message

xoranges.cpp: In function 'int main()':
xoranges.cpp:8:31: warning: unused variable 'k' [-Wunused-variable]
    8 |     long long int n, q, i, j, k, a, b, c, x, d;
      |                               ^
xoranges.cpp:8:46: warning: unused variable 'd' [-Wunused-variable]
    8 |     long long int n, q, i, j, k, a, b, c, x, d;
      |                                              ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1010 ms 5228 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -