Submission #446724

#TimeUsernameProblemLanguageResultExecution timeMemory
446724fuad27XORanges (eJOI19_xoranges)C++14
38 / 100
666 ms3936 KiB
#include<bits/stdc++.h> using namespace std; #define pass true int main () { int n, q; cin >> n >> q; vector<int> prefix(n+1, 0); vector<int> prefixOdd(n+1, 0); vector<int> v(n, 0); bool check = false; for(int i = 0;i<n;i++) { int p; cin >> p; prefix[i+1] = prefix[i] ^ p; if(i%2 == 0) { prefixOdd[i+1] = prefixOdd[i] ^ p; } else { prefixOdd[i+1] = prefixOdd[i]; } v[i] = p; } while(q--) { int k; cin >> k; if(k == 1) { check = true; int i, j; cin >> i >> j; v[i-1] = j; } else { int l, u; cin >> l >> u; if(!check) { if((u - l)%2 == 0) { if(l%2 == 1) { int ans = prefixOdd[u] ^ prefixOdd[l-1]; cout<<(ans)<<endl; } else { int ans = prefix[u] ^ prefixOdd[u] ^ prefix[l-1] ^ prefixOdd[l-1]; cout<<ans<<endl; } } else { cout<<0<<endl; } } else { pass; } } } }

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:51:9: warning: statement has no effect [-Wunused-value]
   51 |     pass;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...