답안 #568269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
568269 2022-05-25T04:43:51 Z gg123_pe 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std; 

typedef long long ll; 
typedef pair<ll,ll> ii; 
#define f(i,a,b) for(int i = a; i < b; i++)
#define fa(i,a,b) for(int i = a; i >= b; i--)

#define ff first 
#define ss second 

const int N = 1005; 
const ll inf = 1e17 + 100; 


int n, a[N], L[N][N], R[N][N]; 

void go(int l, int r){
    if(l == r){
        L[l][l] = R[l][l] = a[l]; 
        return ;
    }
    int m = (l+r)>>1; 
    
    L[m][m] = a[m]; 
    fa(i,m-1,l) L[m][i] = Secret(a[i], L[m][i+1]); 

    R[m+1][m+1] = a[m+1];
    f(i,m+2,r+1) R[m+1][i] = Secret(R[m+1][i-1], a[i]);   

    go(l, m), go(m+1, r); 
}
void Init(int ni, vector <int> x){
    n = ni; 
    f(i,0,n) a[i] = x[i];

    go(0, n-1);  
}

int Query(int x, int y){
    int l = 0, r = n-1; 
    while(1){
        int m = (l+r)>>1; 
        if(y == m)
            return L[y][x]; 
        if(x == m+1)
            return R[x][y];
        if(x <= m and m+1 <= y)
            return Secret(L[m][x], R[m+1][y]); 

        if(y < m) r = m;  
        else l = m+1; 
    }
    return -1; 
}

Compilation message

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