답안 #320052

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320052 2020-11-07T12:16:12 Z vipghn2003 Mountains (IOI17_mountains) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
using namespace std;

const int N=2005;
int n,dp[N][N];
pii point[N];

bool check(int l,int best,int r)
{
    long long val=1ll*(point[best].fi-point[l].fi)*(point[r].se-point[l].se)-1ll*(point[best].se-point[l].se)*(point[r].fi-point[l].fi);
    return (val>=0);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>point[i].se;
        point[i].fi=i;
    }
    for(int r=1;r<=n;r++)
    {
        dp[r][r]=1;
        dp[r-1][r]=1;
        int best=r-1,cur=0;
        for(int l=r-2;l>=0;l--)
        {
            if(check(l-1,best-1,r-1))
            {
                cur+=dp[l+1][best-1];
                best=l;
            }
            dp[l][r]=max(dp[l][r-1],cur+1+dp[l][best-1]);
        }
    }
    cout<<dp[1][n];
}

Compilation message

/tmp/ccnPjdUK.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccd7547a.o:mountains.cpp:(.text.startup+0x0): first defined here
/tmp/ccnPjdUK.o: In function `main':
grader.cpp:(.text.startup+0x1ec): undefined reference to `maximum_deevs(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status