# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
406636 |
2021-05-17T21:59:22 Z |
ScarletS |
Secret (JOI14_secret) |
C++17 |
|
538 ms |
8304 KB |
#include <bits/stdc++.h>
#include "secret.h"
int n, a[1000], pre[1000][1000];
void build(int l, int r)
{
if (l+1>=r)
return;
int m=l+(r-l)/2;
pre[m][m]=a[m];
pre[m+1][m+1]=a[m];
for (int i=m-1;i>=l;--i)
pre[i][m]=Secret(a[i],pre[i+1][m]);
for (int i=m+2;i<=r;++i)
pre[m+1][i]=Secret(pre[m+1][i-1],a[i]);
build(l,m);
build(m+1,r);
}
void Init(int N, int A[])
{
n=N;
for (int i=0;i<n;++i)
a[i]=A[i];
build(0,n-1);
}
int Query(int l, int r)
{
if (l==r)
return a[l];
if (l+1==r)
return Secret(a[l],a[r]);
int x=0, y=n-1, m;
while (1)
{
m=x+(y-x)/2;
if (l<=m&&m<r)
return Secret(pre[l][m],pre[m+1][r]);
if (m<l)
x=m+1;
else
y=m;
}
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
154 ms |
4268 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 39217574. |
2 |
Incorrect |
136 ms |
4320 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 552147169. |
3 |
Incorrect |
139 ms |
4288 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 486861108. |
4 |
Incorrect |
531 ms |
8276 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 600440873. |
5 |
Incorrect |
509 ms |
8104 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 711464990. |
6 |
Incorrect |
510 ms |
8284 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 33559417. |
7 |
Incorrect |
538 ms |
8128 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 743153696. |
8 |
Incorrect |
520 ms |
8116 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 421960072. |
9 |
Incorrect |
518 ms |
8304 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 433988643. |
10 |
Incorrect |
521 ms |
8196 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 876144393. |