#include "secret.h"
#include <bits/stdc++.h>
typedef std::pair<int,int> pii;
#define f first
#define s second
const int maxn = 1030;
int v[maxn], n;
std::map<pii, int> m;
std::set<pii> s;
class Seg{
public:
int join(int a, int b){
if(a == -1) return b;
if(b == -1) return a;
pii x = {a, b};
if(s.find(x) == s.end()) m[x] = Secret(a, b), s.insert(x);
return m[x];
}
void build(int node, int l, int r){
if(l == r){
tree[node] = v[l];
return;
}
int mid = (l + r) >> 1;
build(2*node, l, mid), build(2*node+1, mid+1, r);
tree[node] = join(tree[2*node], tree[2*node+1]);
}
int query(int node, int tl, int tr, int l, int r){
if(tl > r or tr < l) return -1;
if(tl >= l and tr <= r) return tree[node];
int mid = (tl + tr) >> 1;
return join(query(2*node, tl, mid, l, r), query(2*node+1, mid+1, tr, l, r));
}
private:
int tree[2*maxn];
}seg;
void Init(int N, int A[]) {
n = N;
for(int i=1; i<=N; i++) v[i] = A[i-1];
seg.build(1, 1, N);
for(int l=1; l<=N/2; l++){
for(int r=l+1; r<=N/2; r++){
seg.query(1, 1, N, l, r);
}
}
for(int l=N/2+1; l<=N; l++){
for(int r=l+1; r<=N; r++){
seg.query(1, 1, N, l, r);
}
}
}
int Query(int L, int R) {
L++, R++;
return seg.query(1, 1, n, L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
349 ms |
10476 KB |
Output isn't correct - number of calls to Secret by Init = 65034, maximum number of calls to Secret by Query = 2 |
2 |
Partially correct |
338 ms |
10216 KB |
Output isn't correct - number of calls to Secret by Init = 65281, maximum number of calls to Secret by Query = 1 |
3 |
Partially correct |
340 ms |
10284 KB |
Output isn't correct - number of calls to Secret by Init = 65545, maximum number of calls to Secret by Query = 2 |
4 |
Partially correct |
1308 ms |
32368 KB |
Output isn't correct - number of calls to Secret by Init = 249010, maximum number of calls to Secret by Query = 2 |
5 |
Partially correct |
1316 ms |
32396 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |
6 |
Partially correct |
1284 ms |
31912 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |
7 |
Partially correct |
1335 ms |
32748 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
1353 ms |
32952 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
1324 ms |
32748 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
1355 ms |
32960 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |