#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho
#include "secret.h"
using ll=long long;
using ld=long double;
int const INF=1000000005;
ll const LINF=1000000000000000005;
ll const mod=6700417;
ld const PI=3.14159265359;
ll const MAX_N=3e5+5;
ld const EPS=0.00000001;
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(a) (int)a.size()
#define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll pref[1005][1005],v[1005];
void add(ll l,ll r){
if(l==r){
return;
}
ll mid=(l+r)/2;
for(ll i=mid-1;i>=l;i--)
{
pref[i][mid]=Secret(pref[i+1][mid],pref[i][i]);
}
for(ll i=mid+2;i<r;i++)
{
pref[mid+1][i]=Secret(pref[mid+1][i-1],pref[i][i]);
}
add(l,mid-1);
add(mid,r);
}
void Init(int n,int a[]){
for(ll i=0;i<n;i++)
for(ll j=i+1;j<n;j++)
{
pref[i][j]=-1;
}
for(ll i=0;i<n;i++)
{
pref[i][i]=a[i];
v[i]=a[i];
}
add(0,n);
}
int Query(int l,int r){
if(pref[l][r]!=-1){
return pref[l][r];
}
for(ll i=l;i<r;i++)
{
if(pref[l][i]!=-1&&pref[i+1][r]!=-1){
return Secret(pref[l][i],pref[i+1][r]);
}
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
61 | }
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
334 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Runtime error |
346 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
337 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Runtime error |
620 ms |
524288 KB |
Execution killed with signal 9 |
5 |
Runtime error |
640 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Runtime error |
632 ms |
524288 KB |
Execution killed with signal 9 |
7 |
Runtime error |
629 ms |
524288 KB |
Execution killed with signal 9 |
8 |
Runtime error |
622 ms |
524288 KB |
Execution killed with signal 9 |
9 |
Runtime error |
638 ms |
524288 KB |
Execution killed with signal 9 |
10 |
Runtime error |
642 ms |
524288 KB |
Execution killed with signal 9 |