Submission #120559

# Submission time Handle Problem Language Result Execution time Memory
120559 2019-06-24T23:49:48 Z sofhiasouza Mountains (IOI17_mountains) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int maxn = 2010;

int dp[maxn][maxn], n, y[maxn], x[maxn];

long long int cross(int a, int b, int c)
{
	return (long long int)(x[b]-x[a])*(y[c]-y[a]) - (y[b]-y[a])*(x[c]-x[a]);
}

int maximun_deevs(vector < int > vet)
{
	int n = vet.size();
	for(int i = 0 ; i < n ; i++)
	{
		x[i+1] = i+1;
		y[i+1] = vet[i];
	}

	for(int i = 1 ; i <= n ; i++)
	{
		dp[i][i] = dp[i-1][i] = 1;
		int ult = i-1, res = 0;

		for(int j = i-2 ; j > 0 ; j--)
		{
			if(cross(i, ult, j) >= 0)
			{
				res += dp[j+1][ult-1];
				ult = j; 
			}
			dp[j][i] = max(dp[j][i-1], 1+res+dp[j][ult-1]);
		}
	}
	return dp[1][n];
}

Compilation message

/tmp/ccAKjLUx.o: In function `main':
grader.cpp:(.text.startup+0x20a): undefined reference to `maximum_deevs(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status