# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
573821 |
2022-06-07T09:01:25 Z |
Sho10 |
Secret (JOI14_secret) |
C++17 |
|
444 ms |
11332 KB |
#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][i],pref[i+1][mid]);
}
for(ll i=mid+2;i<r;i++)
{
pref[mid+1][i]=Secret(pref[mid+1][i-1],pref[i][i]);
}
add(l,mid);
add(mid+1,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){
// cout<<pref[l][i]<<' '<<pref[i+1][r]<<endl;
return Secret(pref[l][i],pref[i+1][r]);
}
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:62:1: warning: control reaches end of non-void function [-Wreturn-type]
62 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
123 ms |
5324 KB |
Output is correct - number of calls to Secret by Init = 3331, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
122 ms |
5356 KB |
Output is correct - number of calls to Secret by Init = 3340, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
125 ms |
5448 KB |
Output is correct - number of calls to Secret by Init = 3349, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
437 ms |
11092 KB |
Output is correct - number of calls to Secret by Init = 7491, maximum number of calls to Secret by Query = 1 |
5 |
Correct |
444 ms |
11204 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
6 |
Correct |
435 ms |
11332 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
7 |
Correct |
442 ms |
11224 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
435 ms |
11136 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
439 ms |
11196 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
441 ms |
11244 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |