#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]);
}
div(l, mid, A);
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 - 1;
}
}
return block[l][l];
}
// by me
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
102 ms |
6740 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
100 ms |
6740 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
105 ms |
6736 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
376 ms |
8284 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
381 ms |
8280 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
383 ms |
8288 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 0. |
7 |
Incorrect |
382 ms |
8284 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
395 ms |
8252 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
385 ms |
8284 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
376 ms |
8288 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |