#include <bits/stdc++.h>
using namespace std;
//#define int long long
#include "secret.h"
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int B[10005];
struct node{
int s, e, m, val;
node *l, *r;
node(int _s, int _e){
s = _s, e = _e, m = (s + e) >> 1;
if(s != e){
l = new node(s, m);
r = new node(m+1, e);
val = Secret(l->val, r->val);
}
else val = B[s];
}
int qry(int a, int b, int c = -2e9){
if(s == a && b == e){
if(c == -2e9)return val;
else return Secret(c, val);
}
if(b <= m)return l->qry(a, b, c);
else if(a > m)return r->qry(a, b, c);
else{
int x = l->qry(a, m, c);
return r->qry(m+1, b, x);
}
}
}*root;
void Init(int N, int A[]) {
for(int i=0;i<N;i++)B[i] = A[i];
root = new node(0, N - 1);
}
int Query(int L, int R) {
return root->qry(L, R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
165 ms |
2608 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 |
156 ms |
2588 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 |
167 ms |
2508 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 |
486 ms |
4348 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 |
486 ms |
4468 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 |
438 ms |
4432 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 |
497 ms |
4460 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 |
498 ms |
4472 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 |
514 ms |
4444 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 |
497 ms |
4452 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |