# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
536269 |
2022-03-12T16:53:18 Z |
michao |
Secret (JOI14_secret) |
C++14 |
|
514 ms |
4512 KB |
#include <bits/stdc++.h>
#include "secret.h"
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=1e3+5;
const int STALA=30;
int pref[MAX][STALA];
int suf[MAX][STALA];
int n;
int a[MAX];
void rec1(int l,int r,int dep){
if (l>r)return;
int mid=(l+r)>>1;
pref[mid][dep]=a[mid];
suf[mid+1][dep]=a[mid+1];
for (int i=mid-1;i>=l;i--){
pref[i][dep]=Secret(a[i],pref[i+1][dep]);
}
for (int i=mid+2;i<=r;i++){
suf[i][dep]=Secret(suf[i-1][dep],a[i]);
}
if (l<r){
rec1(l,mid,dep+1);
rec1(mid+1,r,dep+1);
}
}
void Init(int N,int A[]){
n=N;
for (int i=0;i<n;i++)a[i]=A[i];
rec1(0,n-1,0);
}
int rec2(int l,int r,int L,int R,int dep){
int mid=(l+r)>>1;
if (L>mid)return rec2(mid+1,r,L,R,dep+1);
if (R<=mid)return rec2(l,mid,L,R,dep+1);
return Secret(pref[mid][dep],suf[mid+1][dep]);
}
int Query(int L,int R){
if (L==R)return a[L];
return rec2(0,n-1,L,R,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
119 ms |
2488 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 457670148. |
2 |
Incorrect |
135 ms |
2444 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 740274302. |
3 |
Incorrect |
138 ms |
2480 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 476925503. |
4 |
Incorrect |
451 ms |
4464 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 5032441. |
5 |
Incorrect |
492 ms |
4460 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 548143376. |
6 |
Incorrect |
514 ms |
4512 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 847868344. |
7 |
Incorrect |
488 ms |
4396 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 72965804. |
8 |
Incorrect |
493 ms |
4400 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 850512170. |
9 |
Incorrect |
489 ms |
4508 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 726732355. |
10 |
Incorrect |
468 ms |
4488 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 671300398. |