/*
ghmt the cutie :3
UwU
*/
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#define INF 1e9
#define f first
#define s second
#define pii pair<int, int>
#define vi vector<int>
const int MAXN = 1000;
const int LG = 9;
int st[LG + 1][MAXN];
void Init(int n, int a[]) {
for(int i = 1; i <= n; i++) st[0][i] = a[i - 1];
for(int j = 1; j <= LG; j++)
for(int i = 1; i + (1 << j) - 1 <= n; i++)
st[j][i] = Secret(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]);
}
int Query(int l, int r) {
l++, r++;
int len = r - l + 1;
int s = -INF;
for(int j = 0; (1 << j) <= len; j++) {
if(len >> j & 1) {
if(s == -INF) s = st[j][l];
else s = Secret(s, st[j][l]);
l = l + (1 << j);
}
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
102 ms |
2808 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 |
98 ms |
2816 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 |
98 ms |
2648 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 |
328 ms |
4356 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 |
331 ms |
4292 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 |
318 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 |
346 ms |
4360 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 |
338 ms |
4436 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 |
339 ms |
4328 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 |
371 ms |
4328 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |