#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 Secret(int a, int b){
return 0;
}
*/int Query(int l, int r){
if(l==r) return t[l];
int x=__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(daq[i+1][nr], t[i]);
for(int i=sr+1; 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);
}
/*int main(){
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
122 ms |
2320 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 138441005. |
2 |
Incorrect |
124 ms |
2372 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 567401795. |
3 |
Incorrect |
120 ms |
2304 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 760778085. |
4 |
Incorrect |
438 ms |
4212 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 670466175. |
5 |
Incorrect |
440 ms |
4352 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 12544832. |
6 |
Incorrect |
450 ms |
4208 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 31688050. |
7 |
Incorrect |
472 ms |
4248 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 407418020. |
8 |
Incorrect |
436 ms |
4324 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 859882001. |
9 |
Incorrect |
452 ms |
4236 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 491979112. |
10 |
Incorrect |
456 ms |
4288 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 849978199. |