# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
852515 |
2023-09-21T21:45:42 Z |
Ammar |
Secret (JOI14_secret) |
C++17 |
|
385 ms |
4688 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int t[10][1001],msk[1001],b[1001];
void build(int x, int l, int r, int a[])
{
if(l>=r)return;
int mid=(l+r)/2;
t[x][mid]=a[mid];
for(int i=mid-1;i>=l;i--)
t[x][i]=Secret(a[i],t[x][i+1]);
t[x][mid+1]=a[mid+1];
for(int i=mid+2;i<=r;i++)
{
t[x][i]=Secret(t[x][i-1],a[i]);
msk[i]|=(1<<x);
}
build(x+1,l,mid,a);
build(x+1,mid+1,r,a);
}
void Init(int n, int a[])
{
for(int i=0;i<n;i++)b[i]=a[i];
build(0,0,n-1,a);
}
int Query(int l, int r)
{
if(l==r)return b[l];
int z=__builtin_ctz(msk[l]^msk[r]);
return Secret(t[z][l],t[z][r]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
100 ms |
2640 KB |
Wrong Answer: Query(264, 271) - expected : 675707686, actual : 406865628. |
2 |
Incorrect |
100 ms |
2640 KB |
Wrong Answer: Query(236, 238) - expected : 173116186, actual : 416517106. |
3 |
Incorrect |
100 ms |
2640 KB |
Wrong Answer: Query(62, 65) - expected : 807499724, actual : 347595172. |
4 |
Incorrect |
375 ms |
4432 KB |
Wrong Answer: Query(45, 63) - expected : 20048392, actual : 361791795. |
5 |
Incorrect |
375 ms |
4512 KB |
Wrong Answer: Query(750, 875) - expected : 92309526, actual : 848452942. |
6 |
Incorrect |
373 ms |
4352 KB |
Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111478025. |
7 |
Correct |
381 ms |
4432 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
385 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 |
383 ms |
4688 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
381 ms |
4460 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |