Submission #1118030

# Submission time Handle Problem Language Result Execution time Memory
1118030 2024-11-24T18:29:41 Z boris_7 XORanges (eJOI19_xoranges) C++17
0 / 100
1000 ms 3152 KB
#include<bits/stdc++.h>

using namespace std;
using ll =  long long;

void solve(){
    int n,q;
    cin>>n>>q;
    vector<int>v(n);
    for(int &i:v){
        cin>>i;
    }
    while(q--){
        int type;
        cin>>type;
        if(type==1){
            int ind,x;
            cin>>ind,x;
            v[--ind]=x;
        }
        else{
            int l,r;
            cin>>l>>r;
            --l,--r;
            ll ans = 0;
            for(int i = l;i<=r;i++){
                for(int j = i;j<=r;j++){
                    for(int k = i;k<=j;k++){
                        ans^=v[k];
                    }
                }
            }
            cout<<ans<<endl;
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    // ll t;cin>>t;while(t--)
        solve();
}

Compilation message

xoranges.cpp: In function 'void solve()':
xoranges.cpp:18:23: warning: right operand of comma operator has no effect [-Wunused-value]
   18 |             cin>>ind,x;
      |                       ^
xoranges.cpp:19:21: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |             v[--ind]=x;
# 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 Correct 407 ms 336 KB Output is correct
2 Correct 339 ms 336 KB Output is correct
3 Correct 454 ms 336 KB Output is correct
4 Execution timed out 1067 ms 336 KB Time limit exceeded
5 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 Execution timed out 1059 ms 3152 KB Time limit exceeded
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 -