# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730973 | 2023-04-26T17:20:34 Z | alexdd | Secret (JOI14_secret) | C++17 | 0 ms | 0 KB |
#include "secret.h" #include<bits/stdc++.h> using namespace std; #define int long long int bit[2][2]; int a[1005]; int n; int op(int x, int y) { int rez=0,a,b; for(int i=0;i<30;i++) { a = ((x&(1<<i))!=0); b = ((y&(1<<i))!=0); rez += (1<<i) * bit[a][b]; } return rez; } void Init(int N, int A[]) { for(int i=0;i<2;i++) for(int j=0;j<2;j++) bit[i][j] = Secret(i,j); n=N; for(int i=1;i<=n;i++) a[i]=A[i]; } int Query(int L, int R) { int rez = a[L]; for(int i=L+1;i<=R;i++) { rez = op(rez, a[L]); } return rez; }