#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>>dp;
void Init(int N, int A[]) {
dp = vector<vector<int>>(N, vector<int>(11));
for(int i = 0;i<N;++i)dp[i][0] = A[i];
for(int j = 1;j<=10;++j){
for(int i = 0;(i+(1ll<<j))-1 < N;++i){
dp[i][j] = Secret(dp[i][j-1],dp[i+(1ll<<(j-1))][j-1]);
}
}
}
int Query(int L, int R) {
int res = -1;
for(int i = 10;i>=0;--i){
if((L+(1ll<<i))-1 <= R){
if(res==-1)res = dp[L][i];
else res = Secret(res, dp[L][i]);
L+=(1ll<<i);
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
140 ms |
2452 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 |
Partially correct |
140 ms |
2340 KB |
Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7 |
3 |
Partially correct |
141 ms |
2316 KB |
Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7 |
4 |
Partially correct |
448 ms |
4300 KB |
Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8 |
5 |
Partially correct |
451 ms |
4356 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
6 |
Partially correct |
425 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2 |
7 |
Partially correct |
470 ms |
4356 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
8 |
Partially correct |
467 ms |
4356 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |
9 |
Partially correct |
465 ms |
4356 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 |
Partially correct |
455 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |