# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
412478 |
2021-05-27T01:18:05 Z |
songc |
Secret (JOI14_secret) |
C++14 |
|
519 ms |
4396 KB |
#include "secret.h"
int N;
int A[1010], T[20][1010];
void dnc(int d, int s, int e){
if (s == e) return;
int m=s+e>>1;
T[d][m+1] = A[m+1];
for (int i=m+2; i<=e; i++) T[d][i] = Secret(T[d][i-1], A[i]);
T[d][m] = A[m];
for (int i=m-1; i>=s; i--) T[d][i] = Secret(T[d][i+1], A[i]);
dnc(d+1, s, m), dnc(d+1, m+1, e);
}
void Init(int _N, int P[]){
N = _N;
for (int i=0; i<N; i++) A[i] = P[i];
dnc(0, 0, N-1);
}
int qry(int d, int s, int e, int ts, int te){
int m=s+e>>1;
if (ts <= m && m <= te) return Secret(T[d][ts], T[d][te]);
if (te <= m) return qry(d+1, s, m, ts, te);
return qry(d+1, m+1, e, ts, te);
}
int Query(int L, int R){
if (L == R) return A[L];
return qry(0, 0, N-1, L, R);
}
Compilation message
secret.cpp: In function 'void dnc(int, int, int)':
secret.cpp:8:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
8 | int m=s+e>>1;
| ~^~
secret.cpp: In function 'int qry(int, int, int, int, int)':
secret.cpp:23:9: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
23 | int m=s+e>>1;
| ~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
134 ms |
2452 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015. |
2 |
Incorrect |
136 ms |
2416 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
137 ms |
2376 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
505 ms |
4344 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
519 ms |
4396 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
506 ms |
4296 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 154975445. |
7 |
Incorrect |
507 ms |
4364 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
508 ms |
4276 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
499 ms |
4376 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
501 ms |
4276 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |