#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
// int Secret(int X, int Y);
const int MAXN = 1010;
int block[MAXN][MAXN];
int n;
void div(int l, int r, int A[]){
if(l >= r){
block[l][l] = A[l];
return;
}
int mid = (l + r) / 2;
block[mid][mid] = A[mid];
block[mid + 1][mid + 1] = A[mid + 1];
for(int i = mid - 1; i >= l; i--){
block[mid][i] = Secret(A[i], block[mid][i + 1]);
}
for(int i = mid + 2; i <= r; i++){
block[mid + 1][i] = Secret(block[mid + 1][i - 1], A[i]);
}
if(l < mid) div(l, mid, A);
if(mid + 1 < r) div(mid + 1, r, A);
}
void Init(int N, int A[]){
n = N;
div(0, N - 1, A);
}
int Query(int L, int R){
int l = 0, r = n - 1;
while(l < r){
int mid = (l + r) / 2;
if(L <= mid && mid < R){
return Secret(block[mid][L], block[mid][R]);
}
else if(mid == R){
return block[mid][L];
}
else if(mid < L){
l = mid + 1;
}
else{
r = mid;
}
}
return block[l][l];
}
// by me
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
102 ms |
6744 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
108 ms |
6744 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
101 ms |
6740 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
386 ms |
8300 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
376 ms |
8268 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
390 ms |
8280 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 942318537. |
7 |
Incorrect |
386 ms |
8280 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
375 ms |
8288 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
376 ms |
8284 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
392 ms |
8504 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |