# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
606101 |
2022-07-26T05:07:23 Z |
kawaii |
Secret (JOI14_secret) |
C++14 |
|
443 ms |
8300 KB |
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
int n, a[1005], pre[1005][1005];
void dnc(int l, int r){
if(l == r) return;
int mid = l + r >> 1;
dnc(l, mid); dnc(mid + 1, r);
for(int i = mid - 1; i >= l; i--) pre[i][mid] = Secret(a[i], pre[i + 1][mid]);
for(int i = mid + 1; i <= r; i++) pre[mid][i] = Secret(pre[mid][i - 1], a[i]);
}
void Init(int N, int A[]){
for(int i = 1; i <= N; i++) a[i] = A[i - 1], pre[i][i] = a[i];
n = N;
dnc(1, n);
}
int solve(int l, int r, int lf, int rt){
int mid = l + r >> 1;
if(lf <= mid && mid <= rt){
if(lf == mid) return pre[mid][rt];
else if(rt == mid) return pre[lf][mid];
return Secret(pre[lf][mid], pre[mid + 1][rt]);
}
if(rt < mid) return solve(l, mid - 1, lf, rt);
else return solve(mid + 1, r, lf, rt);
}
int Query(int L, int R){
L++; R++;
return solve(1, n, L, R);
}
Compilation message
secret.cpp: In function 'void dnc(int, int)':
secret.cpp:9:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
9 | int mid = l + r >> 1;
| ~~^~~
secret.cpp: In function 'int solve(int, int, int, int)':
secret.cpp:22:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
22 | int mid = l + r >> 1;
| ~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
4284 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 805576266. |
2 |
Incorrect |
114 ms |
4360 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 571476064. |
3 |
Incorrect |
125 ms |
4372 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136730926. |
4 |
Incorrect |
434 ms |
8300 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 870547617. |
5 |
Incorrect |
428 ms |
8204 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 976357712. |
6 |
Incorrect |
424 ms |
8216 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 948544795. |
7 |
Incorrect |
443 ms |
8212 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 781793354. |
8 |
Incorrect |
429 ms |
8196 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 499418120. |
9 |
Incorrect |
436 ms |
8104 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 277351906. |
10 |
Incorrect |
437 ms |
8172 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 274498057. |