# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
94832 | easrui | Secret (JOI14_secret) | C++14 | 581 ms | 8484 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"
#include <bits/stdc++.h>
using namespace std;
int D[1001][1001],NN;
int process(int L, int R)
{
if(L==R) return D[L][R];
int M = (L+R)/2;
return D[L][R] = Secret(process(L,M),process(M+1,R));
}
void Init(int N, int A[]) {
for(int i=0; i<N; i++) D[i][i] = A[i];
NN = N;
process(0,N-1);
}
int getans(int S, int E, int L, int R)
{
if(L<=S && E<=R) return D[S][E];
int M = (S+E)/2, P=-1, Q=-1;
if(M>=L) P = getans(S,M,L,R);
if(M+1<=R) Q = getans(M+1,E,L,R);
if(P==-1) return Q;
if(Q==-1) return P;
return Secret(P,Q);
}
int Query(int L, int R) {
return getans(0,NN-1,L,R);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |