# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
160560 |
2019-10-28T13:29:07 Z |
nvmdava |
Secret (JOI14_secret) |
C++17 |
|
606 ms |
8572 KB |
#include "secret.h"
#include <bits/stdc++.h>
int val[1005][1005];
int a[1005];
void get(int l, int r){
if(l > r)
return;
if(l == r){
val[l][l] = a[l];
return;
}
int m1 = (l + r) >> 1;
int m2 = m1 + 1;
val[m1][m1] = a[m1];
val[m2][m2] = a[m2];
for(int i = m1 - 1; i >= l; i--){
val[i][m1] = val[m1][i] = Secret(val[i + 1][m1], a[i]);
}
for(int i = m2 + 1; i <= r; i++){
val[i][m2] = val[m2][i] = Secret(val[i - 1][m2], a[i]);
}
get(l, m1 - 1);
get(m2 + 1, r);
}
void Init(int N, int A[]){
memset(val, -1, sizeof val);
for(int i = 0; i < N; i++)
a[i] = A[i];
get(0, N - 1);
}
int Query(int L, int R) {
if(val[L][R] != -1)
return val[L][R];
for(int i = L; i < R; i++){
if(val[L][i] != -1 && val[i + 1][R] != -1)
return Secret(val[L][i], val[i + 1][R]);
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
162 ms |
6364 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
167 ms |
6448 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
223 ms |
6384 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
596 ms |
8228 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
597 ms |
8264 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 497583184. |
6 |
Incorrect |
598 ms |
8412 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192. |
7 |
Incorrect |
599 ms |
8392 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
599 ms |
8376 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
598 ms |
8572 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
606 ms |
8312 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |