#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];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
6820 KB |
Do not print anything to standard output |
2 |
Incorrect |
161 ms |
6828 KB |
Do not print anything to standard output |
3 |
Incorrect |
174 ms |
6820 KB |
Do not print anything to standard output |
4 |
Incorrect |
607 ms |
8264 KB |
Do not print anything to standard output |
5 |
Incorrect |
628 ms |
8528 KB |
Do not print anything to standard output |
6 |
Incorrect |
617 ms |
8504 KB |
Do not print anything to standard output |
7 |
Incorrect |
610 ms |
8352 KB |
Do not print anything to standard output |
8 |
Incorrect |
617 ms |
8316 KB |
Do not print anything to standard output |
9 |
Incorrect |
621 ms |
8172 KB |
Do not print anything to standard output |
10 |
Incorrect |
634 ms |
8200 KB |
Do not print anything to standard output |