Submission #1043392

# Submission time Handle Problem Language Result Execution time Memory
1043392 2024-08-04T09:02:49 Z BF001 Secret (JOI14_secret) C++17
0 / 100
280 ms 4500 KB
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
 
#define NN 1005
#define K 15

int lf[K][NN], rt[K][NN], n;

void divi(int lv, int l, int r, int A[]){
    if (l == r){
        lf[lv][l] = A[l - 1];
        return;
    }
    int mid = (l + r) >> 1;
    lf[lv][mid] = A[mid - 1];
    for (int i = mid - 1; i >= l; i--){
        lf[lv][i] = Secret(A[i - 1], lf[lv][i + 1]);
    }
    rt[lv][mid + 1] = A[mid];
    for (int i = mid + 2; i <= r; i++){
        rt[lv][i] = Secret(A[i - 1], rt[lv][i - 1]);
    }

    divi(lv + 1, l, mid, A);
    divi(lv + 1, mid + 1, r, A);    
}
 
int get(int lv, int l, int r, int u, int v){
    int mid = (l + r) >> 1;
    if (u <= mid && v >= mid){
        int rtt = lf[lv][u];
        if (v > mid) rtt = Secret(rtt, rt[lv][v]);
        return rtt;
    }
    if (v < mid) return get(lv + 1, l, mid, u, v);
    return get(lv + 1, mid + 1, r, u, v);
}

void Init(int N, int A[]){
    n = N;
    divi(0, 1, n, A);
}

int Query(int L, int R){
    L++; R++;
    return get(0, 1, n, L, R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 2752 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 809782271.
2 Incorrect 72 ms 2732 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376.
3 Incorrect 66 ms 2648 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 136349820.
4 Incorrect 251 ms 4436 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 650789536.
5 Incorrect 255 ms 4432 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 377506838.
6 Incorrect 271 ms 4280 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 61461050.
7 Incorrect 263 ms 4500 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 687550570.
8 Incorrect 280 ms 4272 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 145923264.
9 Incorrect 270 ms 4436 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 18757135.
10 Incorrect 262 ms 4260 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 70590726.