Submission #1043386

# Submission time Handle Problem Language Result Execution time Memory
1043386 2024-08-04T09:00:19 Z BF001 Secret (JOI14_secret) C++17
Compilation error
0 ms 0 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 && r >= 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);
}

int Query(int L, int R){
    L++; R++;
    return get(0, 1, n, L, R);
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:42:17: error: too few arguments to function 'void divi(int, int, int, int*)'
   42 |     divi(0, 1, n);
      |                 ^
secret.cpp:10:6: note: declared here
   10 | void divi(int lv, int l, int r, int A[]){
      |      ^~~~