#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;
#define f first
#define s second
#define MOD 1000000007
#define LOGN 20
#define MAXN 200005
int ranges[1005][1005];
int n;
void build(int l, int r, int A[]) {
if (l > r)
return ;
int mid = (l+r)/2;
ranges[mid][mid] = A[l];
for (int i = mid-1; i >= l; i--)
ranges[i][mid] = Secret(ranges[i+1][mid], A[i]);
for (int i = mid+1; i <= r; i++)
ranges[mid][i] = Secret(ranges[mid][i-1], A[i]);
build(l, mid, A);
build(mid+1, r, A);
}
void Init(int N, int A[]) {
build(0, N-1, A);
n = N;
}
int Query(int L, int R) {
int now_l = 0;
int now_r = n-1;
while (now_l <= now_r) {
int mid = (now_l+now_r)/2;
if (L == mid || R == mid)
return ranges[mid][R];
if (L > mid)
now_l = mid+1;
else if (R < mid)
now_r = mid-1;
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
47 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
20038 ms |
3388 KB |
Time limit exceeded |
2 |
Execution timed out |
20079 ms |
3436 KB |
Time limit exceeded |
3 |
Execution timed out |
20060 ms |
3536 KB |
Time limit exceeded |
4 |
Execution timed out |
20063 ms |
6328 KB |
Time limit exceeded |
5 |
Execution timed out |
20067 ms |
6312 KB |
Time limit exceeded |
6 |
Execution timed out |
20009 ms |
6284 KB |
Time limit exceeded |
7 |
Execution timed out |
20049 ms |
6224 KB |
Time limit exceeded |
8 |
Execution timed out |
20056 ms |
6220 KB |
Time limit exceeded |
9 |
Execution timed out |
20041 ms |
6260 KB |
Time limit exceeded |
10 |
Execution timed out |
20070 ms |
6204 KB |
Time limit exceeded |