# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1086705 |
2024-09-11T09:40:37 Z |
LeonidCuk |
Secret (JOI14_secret) |
C++17 |
|
309 ms |
4488 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
vector<int>v,dp[20];
int n;
void daq(int i,int l,int r)
{
if(l==r)
{
dp[i][l]=v[l];
return;
}
int m=(l+r)/2;
dp[i][m]=v[m];
for(int j=m-1;j>=l;j--)
{
dp[i][j]=Secret(v[j],dp[i][j+1]);
}
dp[i][m+1]=v[m+1];
for(int j=m+2;j<=r;j++)
{
dp[i][j]=Secret(dp[i][j-1],v[j]);
}
daq(i+1,l,m);
daq(i+1,m+1,r);
}
int najdi(int i,int l,int r,int tl,int tr)
{
if(tl==tr)
{
return v[l];
}
int m=(tl+tr)/2;
if(l<=m&&m<r)
{
return Secret(dp[i][l],dp[i][r]);
}
else if(r<m)
{
return najdi(i+1,l,r,tl,m);
}
else
{
return najdi(i+1,l,r,m+1,tr);
}
}
void Init(int N,int A[])
{
n=N;
for(int i=0;i<N;i++)
{
v.push_back(A[i]);
}
for(int i=0;i<20;i++)
{
dp[i].resize(N);
}
daq(0,0,N-1);
}
int Query(int l,int r)
{
return najdi(0,l,r,0,n-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
88 ms |
2392 KB |
Wrong Answer: Query(264, 271) - expected : 675707686, actual : 711376242. |
2 |
Incorrect |
81 ms |
2388 KB |
Wrong Answer: Query(210, 211) - expected : 558550312, actual : 625512066. |
3 |
Incorrect |
82 ms |
2504 KB |
Wrong Answer: Query(352, 384) - expected : 142799164, actual : 237988828. |
4 |
Incorrect |
306 ms |
4436 KB |
Wrong Answer: Query(571, 624) - expected : 309502044, actual : 140042361. |
5 |
Incorrect |
306 ms |
4488 KB |
Wrong Answer: Query(323, 499) - expected : 244860236, actual : 516766077. |
6 |
Incorrect |
305 ms |
4432 KB |
Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111976450. |
7 |
Correct |
306 ms |
4436 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
309 ms |
4432 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
307 ms |
4436 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
306 ms |
4432 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |