#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
// int Secret(int X, int Y);
const int MAXN = 1010;
int block[MAXN][MAXN];
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[]){
div(0, N - 1, A);
}
int Query(int L, int R){
int l, r;
cin >> l >> r;
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
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
108 ms |
7000 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 0. |
2 |
Incorrect |
101 ms |
6748 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0. |
3 |
Incorrect |
100 ms |
6740 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 0. |
4 |
Incorrect |
371 ms |
8276 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 0. |
5 |
Incorrect |
384 ms |
8276 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 0. |
6 |
Incorrect |
380 ms |
8288 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0. |
7 |
Incorrect |
375 ms |
8160 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0. |
8 |
Incorrect |
402 ms |
8284 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 0. |
9 |
Incorrect |
386 ms |
8276 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0. |
10 |
Incorrect |
380 ms |
8284 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0. |