Submission #981565

#TimeUsernameProblemLanguageResultExecution timeMemory
981565NomioXORanges (eJOI19_xoranges)C++17
30 / 100
49 ms65536 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; int a[n + 1], b[n + 1][n + 1] {}; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { for(int k = i; k <= min(i + j - 1, n); k++) { b[i][j] = (b[i][j] ^ a[k]); } } } if(n <= 100) { while(q--) { int t, l, r; cin >> t >> l >> r; if(t == 1) { a[l] = r; } else { int S = a[l]; for(int i = l + 1; i <= r; i++) { S = (S ^ a[i]); } for(int i = 2; i <= r - l + 1; i++) { for(int j = l; j <= r - i + 1; j++) { int A = 0; for(int k = j; k <= j + i - 1; k++) { A = (A ^ a[k]); } S = (S ^ A); } } cout << S << '\n'; } } } else if(n <= 500) { while(q--) { int t, l, r; cin >> t >> l >> r; int S = 0; for(int i = 1; i <= r - l + 1; i++) { for(int j = l; j <= r - i + 1; j++) { S = (S ^ b[j][i]); } } cout << S << '\n'; } } return 0; }
#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...