# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
565521 |
2022-05-21T04:05:04 Z |
ac2hu |
Secret (JOI14_secret) |
C++14 |
|
726 ms |
12212 KB |
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
const int _N = 1e3 + 1;
int RR[_N][_N];// right[i][j] = query(j, i)
int LL[_N][_N]; // left[i][j] = query(i, j)
vector<int> temp;
int a[_N];
int n;
void build(int l,int r){
if(l + 1 < r){
int mid = (l + r - 1)/2;
temp.push_back(mid);
RR[mid + 1][mid] = a[mid + 1];
for(int i = mid + 2;i<=r;i++){
RR[i][mid] = Secret(RR[i - 1][mid], a[i]);
}
LL[mid][mid] = a[mid];
for(int i = mid - 1;i>=0;i--){
LL[i][mid] = Secret(LL[i + 1][mid], a[i]);
}
build(l, mid);
build(mid + 1, r);
}
}
void Init(int N, int A[]) {
for(int i = 0;i<N;i++)
a[i] = A[i];
build(1, N - 1);
}
int Query(int L, int R) {
if(L == R){
return a[L];
}
else if(L + 1 == R)
return Secret(a[L], a[R]);
else{
for(auto e : temp){
if(L <= e && e < R)return Secret(LL[L][e], RR[R][e]);
}
assert(false);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
170 ms |
6340 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
175 ms |
6416 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
170 ms |
6444 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
672 ms |
12196 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
671 ms |
12212 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
690 ms |
12096 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192. |
7 |
Incorrect |
694 ms |
12156 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
675 ms |
12200 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
667 ms |
12092 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
726 ms |
12080 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |