Submission #976837

#TimeUsernameProblemLanguageResultExecution timeMemory
976837IsamXORanges (eJOI19_xoranges)C++17
0 / 100
82 ms7760 KiB
#include<bits/stdc++.h> using namespace std; constexpr int sz = 2e5 + 5; int n, q, a[sz], tree[2][sz]; inline void update(int pos, int val, int bj){ while(pos <= n){ tree[bj][pos] ^= val; pos += (pos & (-pos)); } return; } inline int get_ans(int l, int r, int bj){ if(l ^ 1) return get_ans(1, r, bj) ^ get_ans(1, l - 1, bj); int res(0); while(r > 0){ res ^= tree[bj][r]; r -= (r & (-r)); } return res; } signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n >> q; for(register int i = 1; i <= n; ++i){ cin >> a[i]; update(i, a[i], i & 1); } int type, l, r; while(q--){ cin >> type >> l >> r; if(type == 1){ update(l, a[l], l & 1); a[l] = r; update(l, a[l], l & 1); }else{ if((l & 1) ^ (r & 1)){ cout << get_ans(l, r, 1) << '\n'; }else{ cout << get_ans(l, r, 0) << '\n'; } } } }

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:43:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   43 |  for(register int i = 1; i <= n; ++i){
      |                   ^
#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...