#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 100
#define mp make_pair
#define mid (l+r)/2
#define le node * 2
#define ri node * 2 + 1
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
//#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
#define all(x) x.begin(), x.end()
#define gc getchar_unlocked
typedef long long ll;
typedef short int si;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef pair<double,ll>pdi;
const ll inf=2e18;
const ll mod=1e9+7;
const ld Pi=acos(-1) ;
#include "secret.h"
int n ;
int a [1009] , tree [4009] ;
void build ( int node , int l , int r ) {
if ( l == r ) {
tree [node] = a [l] ;
return ;
}
build ( le , l , mid ) ;
build ( ri , mid + 1 , r ) ;
tree [node] = Secret ( tree [le] , tree [ri] ) ;
}
int query ( int node , int l , int r , int s , int e ) {
if ( s <= l && e >= r ) return tree [node] ;
if ( s <= mid && e >= mid + 1 ) return Secret ( query ( le , l , mid , s , e ) , query ( ri , mid + 1 , r , s , e ) ) ;
else if ( s <= mid ) return query ( le , l , mid , s , e ) ;
else return query ( ri , mid + 1 , r , s , e ) ;
}
void Init ( int N , int A[] ) {
n = N ;
for ( int i = 0 ; i < n ; i ++ ) a [i] = A [i] ;
build ( 1 , 0 , n -1 ) ;
}
int Query ( int L , int R ) {
return query ( 1 , 0 , n - 1 , L , R ) ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
187 ms |
2424 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 |
190 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 |
190 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 |
559 ms |
4600 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 |
564 ms |
4344 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 |
508 ms |
4516 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 |
583 ms |
4344 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 |
584 ms |
4424 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 |
607 ms |
4472 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 |
592 ms |
4268 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |