# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
481463 |
2021-10-21T01:51:50 Z |
jhhope1 |
Secret (JOI14_secret) |
C++14 |
|
448 ms |
4312 KB |
#include<bits/stdc++.h>
#include<secret.h>
const int MAXN = 1010;
int n;
int orig[MAXN];
int V[12][MAXN];
void build(int s, int e, int dep){
if(s==e){
V[dep][s] = orig[s];
return;
}
int m = (s+e)>>1;
build(s, m, dep+1);
build(m+1, e, dep+1);
V[dep][m] = orig[m];
V[dep][m+1] = orig[m+1];
for(int i=m-1 ; i>=s ; i--){
V[dep][i] = Secret(orig[i], V[dep][i+1]);
}
for(int i=m+2 ; i<=e ; i++){
V[dep][i] = Secret(orig[i], V[dep][i-1]);
}
}
void Init(int N, int A[]){
for(int i=0 ; i<N ; i++){
orig[i] = A[i];
}
n = N;
build(0, N-1, 0);
return ;
}
int eval(int s, int e, int l, int r, int dep){
if(s==e){
return orig[s];
}
int m = (s+e)>>1;
if(l<=m && m+1<=r){
return Secret(V[dep][l], V[dep][r]);
}
if(r==m){
return V[dep][l];
}
if(l==m+1){
return V[dep][r];
}
if(l>m+1){
return eval(m+1, e, l, r, dep+1);
}
if(r<m){
return eval(s, m, l, r, dep+1);
}
}
int Query(int L, int R){
return eval(0, n-1, L, R, 0);
}
Compilation message
secret.cpp: In function 'int eval(int, int, int, int, int)':
secret.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
53 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
2372 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271. |
2 |
Incorrect |
121 ms |
2396 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
118 ms |
2376 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820. |
4 |
Incorrect |
448 ms |
4268 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536. |
5 |
Incorrect |
426 ms |
4276 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838. |
6 |
Incorrect |
436 ms |
4216 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050. |
7 |
Incorrect |
428 ms |
4204 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570. |
8 |
Incorrect |
425 ms |
4292 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264. |
9 |
Incorrect |
439 ms |
4312 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135. |
10 |
Incorrect |
428 ms |
4284 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726. |