Submission #636521

# Submission time Handle Problem Language Result Execution time Memory
636521 2022-08-29T13:00:36 Z JooDdae Secret (JOI14_secret) C++17
0 / 100
433 ms 4736 KB
#include "secret.h"

#include <bits/stdc++.h>
using namespace std;

#define mid ((l+r) >> 1)

int n, a[1010];
vector<int> L[4040], R[4040];

void build(int node = 1, int l = 1, int r = n) {
    int u = a[mid-1];
    L[node].push_back(u);
    for(int i=mid-2;i>=l;i--) {
        u = Secret(u, a[i]);
        L[node].push_back(u);
    }

    u = a[mid];
    R[node].push_back(u);
    for(int i=mid+1;i<=r;i++) {
        u = Secret(u, a[i]);
        R[node].push_back(u);
    }

    if(l == r) return;

    build(node*2, l, mid), 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 R[node][nr-mid];
        return Secret(L[node][mid-nl-1], R[node][nr-mid]);
    }

    if(nr < mid) return find(nl, nr, node*2, l, mid);
    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 116 ms 2700 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 50471211.
2 Incorrect 117 ms 2668 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 29530216.
3 Incorrect 125 ms 2728 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 162768982.
4 Incorrect 422 ms 4592 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 858309235.
5 Incorrect 431 ms 4728 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 602966360.
6 Incorrect 414 ms 4636 KB Wrong Answer: Query(200, 208) - expected : 277813445, actual : 143104932.
7 Incorrect 433 ms 4688 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 578359305.
8 Incorrect 425 ms 4736 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 633393600.
9 Incorrect 418 ms 4592 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 148126725.
10 Incorrect 417 ms 4616 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 275769990.