# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
293330 | phillip | Secret (JOI14_secret) | C++14 | 502 ms | 8824 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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[1009],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,+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];
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);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |