# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
542658 | __Variatto | Secret (JOI14_secret) | C++17 | 481 ms | 4360 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 <bits/stdc++.h>
#include "secret.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e3+10, L=10;
int n, daq[MAX][L], q, a, b, t[MAX], pot;
int Query(int l, int r){
if(l==r) return t[l];
int x=32-__builtin_clz(l^r);
return Secret(daq[l][x], daq[r][x]);
}
void rek(int pocz, int kon, int nr){
if(pocz==kon){
daq[pocz][nr]=t[pocz];
return;
}
int sr=(pocz+kon)/2;
daq[sr][nr]=t[sr];
for(int i=sr-1; i>=pocz; i--)
daq[i][nr]=Secret(t[i], daq[i+1][nr]);
daq[sr+1][nr]=t[sr+1];
for(int i=sr+2; i<=kon; i++)
daq[i][nr]=Secret(daq[i-1][nr], t[i]);
rek(pocz, sr, nr-1);
rek(sr+1, kon, nr-1);
}
void Init(int N, int A[]){
n=N;
for(int i=0; i<n; i++)
t[i]=A[i];
while((1<<pot)<n) pot++;
rek(0, n-1, pot);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |