Submission #573813

#TimeUsernameProblemLanguageResultExecution timeMemory
573813Sho10Secret (JOI14_secret)C++17
0 / 100
642 ms524288 KiB
#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 (stderr)

secret.cpp: In function 'int Query(int, int)':
secret.cpp:61:1: warning: control reaches end of non-void function [-Wreturn-type]
   61 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...