#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e3+10, L=10;
int n, daq[MAX][L], q, a, b, t[MAX], pot;
int Query(int l, int r){
if(l==r) return t[l];
int x=32-__builtin_clz(l^r);
return Secret(daq[l][x], daq[r][x]);
}
void rek(int pocz, int kon, int nr){
if(pocz==kon){
daq[pocz][nr]=t[pocz];
return;
}
int sr=(pocz+kon)/2;
daq[sr][nr]=t[sr];
for(int i=sr-1; i>=pocz; i--)
daq[i][nr]=Secret(t[i], daq[i+1][nr]);
daq[sr+1][nr]=t[sr+1];
for(int i=sr+2; i<=kon; i++)
daq[i][nr]=Secret(daq[i-1][nr], t[i]);
rek(pocz, sr, nr-1);
rek(sr+1, kon, nr-1);
}
void Init(int N, int A[]){
n=N;
for(int i=0; i<n; i++)
t[i]=A[i];
while((1<<pot)<n) pot++;
rek(0, n-1, pot);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
129 ms |
2348 KB |
Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
126 ms |
2288 KB |
Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1 |
3 |
Incorrect |
118 ms |
2280 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 471212. |
4 |
Incorrect |
460 ms |
4212 KB |
Wrong Answer: Query(193, 615) - expected : 280593123, actual : 85246568. |
5 |
Incorrect |
443 ms |
4252 KB |
Wrong Answer: Query(761, 790) - expected : 112945480, actual : 955460636. |
6 |
Incorrect |
474 ms |
4228 KB |
Wrong Answer: Query(747, 749) - expected : 244228265, actual : 111478025. |
7 |
Incorrect |
481 ms |
4352 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 63904206. |
8 |
Incorrect |
456 ms |
4304 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 956928724. |
9 |
Incorrect |
454 ms |
4360 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 962205476. |
10 |
Incorrect |
454 ms |
4244 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 508745777. |