#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;
class Seg{
public:
int join(int a, int b){
if(a == -1) return b;
if(b == -1) return a;
pii x = {a, b};
return (m.find(x) != m.end() ? m[x] : m[x] = Secret(a, b));
}
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 |
289 ms |
6764 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 |
284 ms |
6764 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 |
294 ms |
6844 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 |
1101 ms |
20332 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 |
1107 ms |
20472 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 |
1062 ms |
20008 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 |
1115 ms |
20668 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 |
1103 ms |
20588 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 |
1102 ms |
20560 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 |
1103 ms |
20684 KB |
Output isn't correct - number of calls to Secret by Init = 249501, maximum number of calls to Secret by Query = 1 |