답안 #1043765

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1043765 2024-08-04T16:45:08 Z Tofu 비밀 (JOI14_secret) C++11
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long

#define int long long
#define pii pair<int, int>
#define pll pair<ll, ll>

const int MAXN = 1005;
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const ll BFN = (ll)1e16;
// const int BFN = (int)1e8;
int n;
int a[MAXN];
int ans[20][MAXN];

void F(int lv, int l, int r) {
    if(l == r) {
        ans[lv][l] = a[l];
        return;
    }

    int m = (l + r) / 2;
    ans[lv][m] = a[m];
    for(int i = m-1; i >= l; i--) {
        ans[lv][i] = Secret(a[i], ans[lv][i+1]);
    }
    ans[lv][m+1] = a[m+1];
    for(int i = m+2; i <= r; i++) {
        ans[lv][i] = Secret(ans[lv][i-1], a[i]);
    }
    
    F(lv+1, l, m);
    F(lv+1, m+1, r);
}

int G(int lv, int l, int r, int ql, int qr) {
    int m = (l+r)/2;
    if(qr <= m) {
        return G(lv+1, l, m, ql, qr);
    }
    if(m+1 <= ql) {
        return G(lv+1, m+1, r, ql, qr);
    }
    return Secret(ans[lv][ql], ans[lv][qr]);
}

void Init(int N, int A[]) {
    n = N;
    for(int i = 1; i <= n; i++) a[i] = A[i-1];
    F(1, 1, n);
}

int Query(int L, int R) {
    if(L == R) return a[L];
    return G(1, 1, n, L, R);
}

Compilation message

/usr/bin/ld: /tmp/ccKMSc7b.o: in function `main':
grader.cpp:(.text.startup+0x2a8): undefined reference to `Init(int, int*)'
/usr/bin/ld: grader.cpp:(.text.startup+0x30b): undefined reference to `Query(int, int)'
collect2: error: ld returned 1 exit status