#include "secret.h"
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
#define pb push_back
#define ln 2*x+1
#define rn 2*x+2
#define m (l+r)/2
using namespace std;
int a[10009],seg[4009],n;
void bld(int x,int l,int r)
{
if(l==r)
{
seg[x]=a[l];
return;
}
bld(ln,l,m);
bld(rn,m+1,r);
seg[x]=Secret(seg[ln],seg[rn]);
}
void Init(int N, int A[])
{
n=N;
for(int i=0;i<n;i++)a[i]=A[i];
// cout<<';';
bld(0,0,N-1);
}
int qu(int x,int l,int r,int b,int e)
{
if(b<=l&&r<=e)return seg[x];
if(m>=b&&m<e)return Secret(qu(ln,l,m,b,e),qu(rn,m+1,r,b,e));
else if(m<e)return qu(rn,m+1,r,b,e);
else return qu(ln,l,m,b,e);
}
int Query(int L, int R)
{
return qu(0,0,n-1,L,R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
188 ms |
2428 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 |
189 ms |
2424 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 |
187 ms |
2424 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 |
553 ms |
4344 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 |
559 ms |
4572 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 |
505 ms |
4344 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 |
585 ms |
4472 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 |
585 ms |
4600 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 |
583 ms |
4604 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 |
590 ms |
4344 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |