Submission #675883

# Submission time Handle Problem Language Result Execution time Memory
675883 2022-12-28T09:31:34 Z Kubeti XORanges (eJOI19_xoranges) C++14
55 / 100
453 ms 5408 KB
#include <iostream>
#include <vector>
#define int long long
using namespace std;
int v[1000001], s[5][1000001];
int32_t main() {
    int n, q;
    cin>>n>>q;
    for(int i=1; i<=n; i++)
        cin>>v[i];
    if(n <= 5000){
        for(int i=0; i<q; i++){
            int t;
            cin>>t;
            if(t == 1){
                int x, y;
                cin>>x>>y;
                v[x] = y;
            }
            else{
                int x, y;
                cin>>x>>y;
                if(abs(x-y)%2 == 1){
                    cout<<0<<'\n';
                }
                else{
                    int sum=0;
                    for(;x<=y;x+=2)
                        sum^=v[x];
                    cout<<sum<<'\n';
                }
            }
        }
    }
    else{
        for(int i=2; i<=n; i++){
            s[i&2][i] ^= s[i&2][i-2];
        }
        for(int h=0; h<q; h++){
            int t, x, y;
            cin>>t>>x>>y;
            if(abs(x-y)%2 == 1){
                cout<<0<<'\n';
                continue;
            }
            int ans = s[y&1][y]^s[x&1][x-1]<<'\n';
            cout<<ans<<'\n';
        }
    }
    return 0;
}
 /*
int main(){
    int n;
    cin>>n;
    vector<vector<int>> v(n+1);
    for(int i=1; i<=n; i++){
        for(int j=i; j<=n; j++){
            for(int x=i; x<=j; x++)
                v[x].push_back(x);
        }
    }
    for(int i=1; i<=n; i++){
        for(auto it:v[i])
            cout<<it<<" ";
        cout<<"-> "<<v[i].size()<<endl;
    }
} */

/*
 for(int i=2; i<=n; i++){
     s[i&2][i] ^= s[i&2][i-2];
 }
 for(int h=0; h<q; h++){
     int t, x, y;
     cin>>t>>x>>y;
     if(abs(x-y)%2 == 1){
         cout<<0<<'\n';
         continue;
     }
     int ans = s[y&1][y]^s[x&1][x-1]<<'\n';
     cout<<ans<<'\n';
 }
 return 0;
 */
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 9 ms 340 KB Output is correct
12 Correct 9 ms 340 KB Output is correct
13 Correct 15 ms 368 KB Output is correct
14 Correct 16 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 453 ms 5408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 2 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 2 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 9 ms 340 KB Output is correct
12 Correct 9 ms 340 KB Output is correct
13 Correct 15 ms 368 KB Output is correct
14 Correct 16 ms 380 KB Output is correct
15 Incorrect 453 ms 5408 KB Output isn't correct
16 Halted 0 ms 0 KB -