#include "bits/stdc++.h"
#include "secret.h"
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif
const int M = 1005;
int a[M];
int ask(int a, int b){
if(a == -1) return b;
if(b == -1) return a;
return Secret(a, b);
}
struct ST{
int tree[M<<2];
void build(int lx = 0, int rx = M, int x = 1){
if(lx == rx) { tree[x] = a[lx]; return; }
int m = (lx + rx) >> 1;
build(lx, m, x<<1), build(m+1, rx, x<<1|1);
tree[x] = ask(tree[x<<1], tree[x<<1|1]);
}
int get(int l, int r, int lx = 0, int rx = M, int x = 1){
if(lx > r || rx < l) return -1;
if(lx >= l && rx <= r) return tree[x];
int m = (lx + rx) >> 1;
int c1 = get(l ,r, lx, m, x<<1), c2 = get(l, r, m+1, rx, x<<1|1);
return ask(c1, c2);
}
}tree;
void Init(int N, int A[]) {
for(int i=0;i<N;i++){
a[i] = A[i];
}
tree.build();
}
int Query(int L, int R) {
return tree.get(L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
158 ms |
2356 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 13 |
2 |
Partially correct |
165 ms |
2396 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 13 |
3 |
Partially correct |
165 ms |
2500 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 13 |
4 |
Partially correct |
530 ms |
4308 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 15 |
5 |
Partially correct |
476 ms |
4268 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 15 |
6 |
Partially correct |
443 ms |
4264 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 4 |
7 |
Partially correct |
521 ms |
4260 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 16 |
8 |
Partially correct |
505 ms |
4260 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 15 |
9 |
Partially correct |
544 ms |
4352 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 16 |
10 |
Partially correct |
504 ms |
4248 KB |
Output is partially correct - number of calls to Secret by Init = 1005, maximum number of calls to Secret by Query = 15 |