#include "secret.h"
#define mid(l, u) ((l+u)/2)
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
using namespace std;
int DP[1000][1000];
int segtree[4000];
int n;
int build(int l, int u, int i, int a[]){
if(l==u) return DP[l][u] = segtree[i] = a[l];
return DP[l][u] = segtree[i] = Secret(build(l, mid(l, u), lchild(i), a), build(mid(l, u)+1, u, rchild(i), a));
}
int query(int l, int u, int i, int ll, int uu){
if(DP[ll][uu]>-1) return DP[ll][uu];
if(l>=ll && u<=uu) return segtree[i];
if(ll>mid(l, u)) return query(mid(l, u)+1, u, rchild(i), ll, uu);
if(uu<=mid(l, u)) return query(l, mid(l, u), lchild(i), ll, uu);
return DP[ll][uu] = Secret(query(l, mid(l, u), lchild(i), ll, mid(l, u)), query(mid(l, u)+1, u, rchild(i), mid(l, u)+1, uu));
}
void Init(int N, int A[]){
n = N;
for(int i = 0;i<n;i++){
for(int j = 0;j<n;j++) DP[i][j] = -1;
}
build(0, n-1, 0, A);
for(int i = 0;i<n;i++){
for(int j = i;j<n;j++){
query(0, n-1, 0, i, j);
}
}
}
int Query(int L, int R){
return query(0, n-1, 0, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
237 ms |
4600 KB |
Output isn't correct - number of calls to Secret by Init = 130305, maximum number of calls to Secret by Query = 0 |
2 |
Partially correct |
237 ms |
4344 KB |
Output isn't correct - number of calls to Secret by Init = 130816, maximum number of calls to Secret by Query = 0 |
3 |
Partially correct |
246 ms |
4392 KB |
Output isn't correct - number of calls to Secret by Init = 131328, maximum number of calls to Secret by Query = 0 |
4 |
Partially correct |
893 ms |
8344 KB |
Output isn't correct - number of calls to Secret by Init = 498501, maximum number of calls to Secret by Query = 0 |
5 |
Partially correct |
895 ms |
8184 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |
6 |
Partially correct |
873 ms |
8184 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |
7 |
Partially correct |
883 ms |
8184 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |
8 |
Partially correct |
877 ms |
8184 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |
9 |
Partially correct |
903 ms |
8364 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |
10 |
Partially correct |
886 ms |
8236 KB |
Output isn't correct - number of calls to Secret by Init = 499500, maximum number of calls to Secret by Query = 0 |