#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9;
//int Secret(int a, int b){
// return min(a / 2 + b, mod);
//}
int range[1000][1000];
vector<int> a;
int n, ask;
void rec(int l, int r){
if(l > r) return;
if(l == r){
range[l][r] = a[l];
return;
}
if(r-l == 1){
range[l][r] = Secret(a[l], a[l + 1]);
ask++;
return;
}
int mid = (l + r) >> 1;
int oper = a[mid];
range[mid][mid] = oper;
for(int i = mid+1; i <= r; i++){
oper = Secret(oper, a[i]);
range[mid][i] = oper;
}
oper = a[mid-1];
for(int i = mid-1; i >= l; i--){
if(i != mid-1) oper = Secret(oper, a[i]);
for(int j = mid; j <= r; j++){
range[i][j] = Secret(oper, range[mid][j]);
}
}
rec(l, mid);
rec(mid+1, r);
}
void Init(int N, int A[]){
// Secret(0, 1000000000);
cin >> N;
n = N;
for(int i = 0;i < N; i++) a.push_back(A[i]);
rec(0, n-1);
// cout << "Number of calling Secret is " << ask << '\n';
}
int Query(int l, int r){
return range[l][r];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
164 ms |
6748 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 50471211. |
2 |
Incorrect |
163 ms |
6744 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 29530216. |
3 |
Incorrect |
168 ms |
6752 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 162768982. |
4 |
Incorrect |
615 ms |
8272 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 858309235. |
5 |
Incorrect |
617 ms |
8092 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 602966360. |
6 |
Incorrect |
614 ms |
8288 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0. |
7 |
Incorrect |
624 ms |
8272 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 578359305. |
8 |
Incorrect |
628 ms |
8288 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 633393600. |
9 |
Incorrect |
636 ms |
8284 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 148126725. |
10 |
Incorrect |
615 ms |
8212 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 275769990. |