Submission #111509

#TimeUsernameProblemLanguageResultExecution timeMemory
111509vexSecret (JOI14_secret)C++14
0 / 100
550 ms8440 KiB
#include <bits/stdc++.h> #include <secret.h> #define maxn 1005 #define pii pair<int,int> using namespace std; int len; vector<pii>v; int rez[maxn][maxn]; void napravi(int l,int r,int a[]) { int duz=r-l+1; if(duz<=1)return; int mid=(l+r)/2; v.push_back({l,r}); rez[mid][mid+1]=a[mid+1]; rez[mid][mid]=a[mid]; for(int i=mid+2;i<=r;i++)rez[mid][i]=Secret(rez[mid][i-1],a[i]); for(int i=mid-1;i>=l;i--)rez[i][mid]=Secret(a[i],rez[i+1][mid]); napravi(l,mid-1,a); napravi(mid+1,r,a); } void Init(int n,int a[]) { len=n; napravi(0,n-1,a); } int Query(int l,int r) { for(auto x:v) { int ll=x.first; int rr=x.second; int mid=(ll+rr)/2; if(ll<=l && l<=mid && mid<=r && r<=rr) { if(r==mid)return rez[l][mid]; return Secret(rez[l][mid],rez[mid][r]); } } }

Compilation message (stderr)

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