?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
240202214 |
Practice: genyi_sith |
1511G - 11 | C++14 (GCC 6-32) | Accepted | 1450 ms | 16448 KB | 2024-01-04 11:23:25 | 2024-01-04 11:23:25 |
// LUOGU_RID: 141884338 #include<bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int b[20][N], a[N]; int main() { int n, m, q, i, j, x; cin>>n>>m; for(i=1;i<=n;i++) cin>>x, a[x] ^= 1; for(i=1;i<=m;i++) a[i] ^= a[i-1]; for(i=1;(1<<i)<=m;i++) for(j=1;j+(1<<i)-1<=m;j++) b[i][j] = b[i-1][j] ^ b[i-1][j+(1<<i-1)] ^ ((a[j+(1<<i)-1] ^ a[j+(1<<i-1)-1]) << i - 1); cin>>q;while(q--) { int l, r, k = 0;cin>>l>>r; for(i=20;~i;i--) if(l+(1<<i)<=r) { k ^= b[i][l], l += 1 << i; if(a[r]^a[l-1]) k ^= 1 << i; } if(k) cout<<"A";else cout<<"B"; } return 0; }
?
?
?
?