# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738597 | MEGalodon | Secret (JOI14_secret) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "secret.h"
#define MAXN 1001
int dat[MAXN][12];
int mask[MAXN];
void divi(int l, int r, int lev, int A[]){ //zero indexed
if( l == r ){ dat[l][11] = A[l]; return; }
int m = (l+r)/2;
dat[m][lev] = A[m];
dat[m+1][lev] = A[m+1]; //makes a difference in this case
for( int i{m-1} ; i >= l ; --i ) dat[i][lev] = Secret(A[i], dat[i+1][lev]);
for( int i{m+2} ; i <= r ; ++i ) dat[i][lev] = Secret(dat[i-1][lev], A[i]);
for( int i{m+1} ; i <= r ; ++i ) mask[i] ^= (1<<lev);
divi(l, m, lev+1, A);
divi(m+1, r, lev+1, A);
}
void Init(int N, int A[]) {
divi(0, N-1, 0, A);
return;
}