# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
636524 |
2022-08-29T13:09:30 Z |
JooDdae |
Secret (JOI14_secret) |
C++17 |
|
431 ms |
4540 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#define mid ((l+r) >> 1)
int n, a[1010];
vector<int> LL[4040], RR[4040];
void build(int node = 1, int l = 1, int r = n) {
if(l > r) return;
RR[node].push_back(a[mid]);
for(int i=mid+1;i<=r;i++) {
RR[node].push_back(Secret(a[i], RR[node].back()));
}
if(l == r) return;
LL[node].push_back(a[mid-1]);
for(int i=mid-2;i>=l;i--) {
LL[node].push_back(Secret(a[i], LL[node].back()));
}
build(node*2, l, mid-1), build(node*2+1, mid+1, r);
}
void Init(int N, int A[]) {
n = N;
for(int i=1;i<=n;i++) a[i] = A[i-1];
build();
}
int find(int nl, int nr, int node = 1, int l = 1, int r = n) {
if(nl <= mid && mid <= nr) {
if(mid == nl) return RR[node][nr-mid];
return Secret(LL[node][mid-nl-1], RR[node][nr-mid]);
}
if(nr < mid) return find(nl, nr, node*2, l, mid-1);
return find(nl, nr, node*2+1, mid+1, r);
}
int Query(int L, int R) {
return find(L+1, R+1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
114 ms |
2508 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 319912893. |
2 |
Incorrect |
111 ms |
2480 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 673849481. |
3 |
Incorrect |
113 ms |
2520 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996. |
4 |
Incorrect |
410 ms |
4492 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 327860453. |
5 |
Incorrect |
413 ms |
4540 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 339249436. |
6 |
Incorrect |
420 ms |
4464 KB |
Wrong Answer: Query(200, 208) - expected : 277813445, actual : 557678151. |
7 |
Incorrect |
427 ms |
4504 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 3868680. |
8 |
Incorrect |
416 ms |
4520 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 884260864. |
9 |
Incorrect |
431 ms |
4536 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 559157025. |
10 |
Incorrect |
428 ms |
4472 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 813114883. |