# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
239868 |
2020-06-17T12:30:34 Z |
MvC |
Secret (JOI14_secret) |
C++11 |
|
543 ms |
8420 KB |
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include "secret.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e3+50;
const ll mod=1e9+7;
using namespace std;
int a[nmax],b[nmax][nmax];
void build(int l,int r)
{
if(l>=r)return;
if(l==r-1)
{
b[l][r]=Secret(a[l],a[r]);
return;
}
int mid=(l+r)/2;
for(int i=mid-1;i>=l;i--)b[i][mid]=Secret(a[i],b[i+1][mid]);
for(int i=mid+2;i<=r;i++)b[mid+1][i]=Secret(b[mid+1][i-1],a[i]);
build(l,mid);
build(mid+1,r);
}
void Init(int n,int A[])
{
for(int i=1;i<=n;i++)a[i]=A[i-1];
for(int i=1;i<=n;i++)
{
for(int j=i;j<=n;j++)
{
if(i==j)b[i][i]=a[i];
else b[i][j]=-1;
}
}
build(1,n);
}
int Query(int l,int r)
{
l++,r++;
if(b[l][r]!=-1)return b[l][r];
for(int i=l;i<r;i++)if(b[l][i]!=-1 && b[i+1][r]!=-1)return Secret(b[l][i],b[i+1][r]);
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
return 0;
}*/
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:56:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
152 ms |
4524 KB |
Output is correct - number of calls to Secret by Init = 3833, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
224 ms |
4472 KB |
Output is correct - number of calls to Secret by Init = 3842, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
150 ms |
4472 KB |
Output is correct - number of calls to Secret by Init = 3851, maximum number of calls to Secret by Query = 1 |
4 |
Partially correct |
518 ms |
8408 KB |
Output isn't correct - number of calls to Secret by Init = 8456, maximum number of calls to Secret by Query = 1 |
5 |
Partially correct |
522 ms |
8396 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
6 |
Partially correct |
515 ms |
8416 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
7 |
Partially correct |
525 ms |
8404 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
534 ms |
8364 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
543 ms |
8420 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
533 ms |
8400 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |