답안 #210276

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210276 2020-03-17T01:33:32 Z eric_xiao Xylophone (JOI18_xylophone) C++14
컴파일 오류
0 ms 0 KB
#include "xylophone.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll A[100009],lf[100009],lf2[100009];
void solve(ll N)
{
    ll i,j,k,mn = 1000000000;
    vector<ll> ck;
    A[1] = 0;
    A[2] = A[1]+query(1,2);
    ck.push_back(A[1]);
    ck.push_back(A[2]);
    mn = min(A[1],A[2]);
    for(i = 3;i <= N;i++)
    {
        lf[i] = query(i-1,i);
        lf2[i] = query(i-2,i);
        A[i] = A[i-1]+lf[i];
        if(max({A[i],A[i-1],A[i-2]}) - min({A[i],A[i-1],A[i-2]}) != lf2[i])
        {
            A[i] = A[i-1] - lf[i];
        }
        mn = min(mn,A[i]);
    }
    ll cg = 0,sm = 0;
    for(i = 1;i <= N;i++)
    {
        A[i] = A[i] - mn + 1;
        if(A[i] == 1) sm = 1;
        if(A[i] == N)
        {
            if(sm == 1) cg = 1;
        }
    }
    if(cg == 1)
    {
        for(i = 1;i <= N;i++)
        {
            A[i] = N + 1 - A[i];
        }
    }
    for(i = 1;i <= N;i++)
    {
        answer(i,A[i]);
    }
}

Compilation message

xylophone.cpp: In function 'void solve(long long int)':
xylophone.cpp:8:10: warning: unused variable 'j' [-Wunused-variable]
     ll i,j,k,mn = 1000000000;
          ^
xylophone.cpp:8:12: warning: unused variable 'k' [-Wunused-variable]
     ll i,j,k,mn = 1000000000;
            ^
/tmp/cc3ekWDo.o: In function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status