#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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
185 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13 |
2 |
Partially correct |
187 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14 |
3 |
Partially correct |
192 ms |
4472 KB |
Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15 |
4 |
Partially correct |
553 ms |
8284 KB |
Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15 |
5 |
Partially correct |
549 ms |
8336 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15 |
6 |
Partially correct |
528 ms |
8264 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4 |
7 |
Partially correct |
581 ms |
8312 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
8 |
Partially correct |
576 ms |
8484 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
9 |
Partially correct |
575 ms |
8440 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
10 |
Partially correct |
581 ms |
8312 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |