Submission #636525

# Submission time Handle Problem Language Result Execution time Memory
636525 2022-08-29T13:11:36 Z JooDdae Secret (JOI14_secret) C++17
0 / 100
446 ms 4552 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;

    LL[node].push_back(a[mid]);
    for(int i=mid-1;i>=l;i--) {
        LL[node].push_back(Secret(a[i], LL[node].back()));
    }

    if(l == r) return;

    RR[node].push_back(a[mid+1]);
    for(int i=mid+2;i<=r;i++) {
        RR[node].push_back(Secret(a[i], RR[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 == nr) return LL[node][mid-nl];
        return Secret(LL[node][mid-nl], RR[node][nr-mid-1]);
    }

    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 2496 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 115 ms 2536 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 111 ms 2504 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 435 ms 4468 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 409 ms 4480 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 446 ms 4476 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 415063604.
7 Incorrect 415 ms 4500 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 414 ms 4504 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 410 ms 4428 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 432 ms 4552 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.