# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
540762 |
2022-03-21T17:00:38 Z |
ammar2000 |
Secret (JOI14_secret) |
C++17 |
|
441 ms |
4700 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
int a[1111];
int n;
vector<int> pre[4444];
vector<int> suf[4444];
void build(int p,int s,int e)
{
if(s==e){
pre[p].push_back(a[s]);
return;
}
int mid=(s+e)/2;
build(p*2,s,mid);
build(p*2+1,mid+1,e);
pre[p].push_back(a[mid+1]);
for(int i=mid+2;i<=e;i++){
pre[p].push_back((pre[p].back(),a[i]));
}
suf[p].push_back(a[mid]);
for(int i=mid-1;i>=s;i--){
suf[p].push_back(Secret(suf[p].back(),a[i]));
}
}
int get(int p,int s,int e,int a,int b)
{
int mid=(s+e)/2;
if(a<=mid&&mid<=b){
if(b==mid){
int h=mid-a;
return suf[p][h];
}
else{
int h=mid-a;
int h2=b-mid-1;
return Secret(suf[p][h],pre[p][h2]);
}
}
if(b<=mid){
return get(p*2,s,mid,a,b);
}
else{
return get(p*2+1,mid+1,e,a,b);
}
}
void Init(int N, int A[]){
n=N;
for(int i=0;i<n;i++){
a[i]=A[i];
}
build(1,0,n-1);
}
int Query(int L, int R) {
return get(1,0,n-1,L,R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
126 ms |
2620 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 135688654. |
2 |
Incorrect |
120 ms |
2640 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 875604137. |
3 |
Incorrect |
114 ms |
2560 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 951529648. |
4 |
Incorrect |
436 ms |
4700 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 581599327. |
5 |
Incorrect |
430 ms |
4532 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 865768728. |
6 |
Incorrect |
429 ms |
4608 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302011346. |
7 |
Incorrect |
429 ms |
4612 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 218866779. |
8 |
Incorrect |
438 ms |
4504 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 745643208. |
9 |
Incorrect |
428 ms |
4684 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 834678660. |
10 |
Incorrect |
441 ms |
4604 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 537520194. |