Submission #1103048

# Submission time Handle Problem Language Result Execution time Memory
1103048 2024-10-19T16:10:04 Z _snoopy_ XORanges (eJOI19_xoranges) C++17
0 / 100
1000 ms 5112 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++){
                if(((c-b+1)+((c-b+1)-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 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1046 ms 5112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -