답안 #53908

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53908 2018-07-01T17:34:52 Z jovan_b 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "secret.h"
typedef long double ld;
typedef long long ll;

ll niz[1005];
ll res[1005][2][1005];
ll n;

ll fajnd(ll l, ll r, ll trl, ll trr){
    if(r-l <= 1) return -1;
    ll mid = (l+r)/2;
    if(l <= trl && trr <= r && trl <= mid && r >= mid) return mid;
    ll x = fajnd(l, mid, trl, trr);
    if(x != -1) return x;
    return fajnd(mid+1, r, trl, trr);
}

void process(ll l, ll r){
    if(r-l <= 1) return;
    ll i = (l+r)/2;
    res[i][0][i] = niz[i];
    res[i][1][i+1] = niz[i+1];
    for(ll j=i-1; j>=l; j--){
        res[i][0][j] = Secret(niz[j], res[i][0][j+1]);
    }
    for(ll j=i+2; j<=r; j++){
        res[i][1][j] = Secret(res[i][1][j-1], niz[j]);
    }
    process(l, i);
    process(i+1, r);
}

void Init(ll N, ll A[]){
    n = N;
    for(ll i=0; i<N; i++) niz[i+1] = A[i];
    process(1, n);
}

ll Query(ll L, ll R){
    L++;
    R++;
    if(L == R) return niz[L];
    if(R == L+1) return Secret(niz[L], niz[R]);
    ll i = fajnd(1, n, L, R);
    return Secret(res[i][0][L], res[i][1][R]);
}

Compilation message

/tmp/ccWv4cGV.o: In function `main':
grader-full.cpp:(.text.startup+0x27b): undefined reference to `Init(int, int*)'
grader-full.cpp:(.text.startup+0x2d3): undefined reference to `Query(int, int)'
collect2: error: ld returned 1 exit status