#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> a(1000 + 5);
int n;
struct node{
node * c[2] = {nullptr, nullptr};
int m = 0,l,r;
vector<int> val;
void init(int l, int r){
this->l = l;this->r = r;
m = (r+l)/2;
val = vector<int>(r-l+1);
val[m-l] = a[m];
for(int i = m-1;i >= l; --i){
val[i-l] = Secret(a[i],val[i+1]);
}
val[m+1-l] = a[m+1];
for(int i = m+2;i <= r; ++i){
val[i-l] = Secret(a[i],val[i-1]);
}
if(r-l+1 >= 5){
c[0] = new node();
c[1] = new node();
c[0]->init(l,m-1);
c[1]->init(m+2,r);
}
}
int query(int L, int R){
if(R <= m-1){
return c[0]->query(L,R);
}
else if(L >= m+2){
return c[1]->query(L,R);
}
else{
if(R == m)return val[L-l];
else if(L == m + 1)return val[R-l];
else return Secret(val[L-l],val[R-l]);
}
}
} root;
void Init(int N, int A[]) {
n = N;
for(int i = 0;i < n; ++i)a[i] = A[i];
root.init(0,n-1);
}
int Query(int L, int R) {
return (L == R ? a[L] :root.query(L,R));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
159 ms |
2692 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 269632672. |
2 |
Incorrect |
156 ms |
2628 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
156 ms |
2552 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820. |
4 |
Runtime error |
587 ms |
8904 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
584 ms |
8700 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
588 ms |
8768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
593 ms |
8828 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
590 ms |
8796 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
603 ms |
8852 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
590 ms |
8932 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |