# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
293354 |
2020-09-08T00:28:29 Z |
XmtosX |
Secret (JOI14_secret) |
C++17 |
|
514 ms |
8448 KB |
#include <bits/stdc++.h>;
#include "secret.h"
using namespace std;
#define LL pos*2+1
#define RR pos*2+2
const int NN=1e3+3;
int a[NN],n,ans[NN][NN],l,r;
void solve(int st,int en)
{
if (st>en)
return;
int mid=(st+en)/2;
ans[mid][mid]=a[mid];
ans[mid+1][mid+1]=a[mid+1];
ans[mid][mid+1]=Secret(a[mid],a[mid+1]);
for (int i=mid+2;i<=en;i++)
ans[mid+1][i]=Secret(ans[mid+1][i-1],a[i]);
for (int i=mid-1;i>=st;i--)
ans[i][mid]=Secret(a[i],ans[i+1][mid]);
solve(st,mid-1);
solve(mid+1,en);
}
int query(int st,int en)
{
int mid=(st+en)/2;
if (mid>r)
return query(st,mid-1);
if (mid<l)
return query(mid+1,en);
if (r==mid||l==mid)
return ans[l][r];
return Secret(ans[l][mid],ans[mid+1][r]);
}
void Init(int N, int A[])
{
n=N;
for (int i=0;i<n;i++)
a[i]=A[i];
solve(0,n-1);
}
int Query(int L, int R)
{
l=L;
r=R;
return query(0,n-1);
}
/*
8
1 4 7 2 5 8 3 6
4
0 3
1 7
5 5
2 4
*/
Compilation message
secret.cpp:1:25: warning: extra tokens at end of #include directive
1 | #include <bits/stdc++.h>;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
4528 KB |
Wrong Answer: Query(255, 409) - expected : 307522235, actual : 0. |
2 |
Incorrect |
135 ms |
4472 KB |
Wrong Answer: Query(127, 153) - expected : 342921603, actual : 0. |
3 |
Incorrect |
134 ms |
4472 KB |
Wrong Answer: Query(272, 278) - expected : 620510644, actual : 0. |
4 |
Incorrect |
500 ms |
8448 KB |
Wrong Answer: Query(374, 396) - expected : 402362963, actual : 0. |
5 |
Incorrect |
500 ms |
8312 KB |
Wrong Answer: Query(937, 999) - expected : 615241818, actual : 0. |
6 |
Incorrect |
496 ms |
8316 KB |
Wrong Answer: Query(811, 813) - expected : 25091616, actual : 0. |
7 |
Partially correct |
512 ms |
8288 KB |
Output isn't correct - number of calls to Secret by Init = 8476, maximum number of calls to Secret by Query = 1 |
8 |
Partially correct |
513 ms |
8184 KB |
Output isn't correct - number of calls to Secret by Init = 8476, maximum number of calls to Secret by Query = 1 |
9 |
Partially correct |
512 ms |
8296 KB |
Output isn't correct - number of calls to Secret by Init = 8476, maximum number of calls to Secret by Query = 1 |
10 |
Partially correct |
514 ms |
8440 KB |
Output isn't correct - number of calls to Secret by Init = 8476, maximum number of calls to Secret by Query = 1 |