Submission #274141

# Submission time Handle Problem Language Result Execution time Memory
274141 2020-08-19T08:44:29 Z anubhavdhar Mountains (IOI17_mountains) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>

#include "mountains.h"

#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first 
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define FOR(i,N) for(i=0;i<(N);++i)
#define FORe(i,N) for(i=1;i<=(N);++i)
#define FORr(i,a,b) for(i=(a);i<(b);++i)
#define FORrev(i,N) for(i=(N);i>=0;--i)
#define F0R(i,N) for(int i=0;i<(N);++i)
#define F0Re(i,N) for(int i=1;i<=(N);++i)
#define F0Rr(i,a,b) for(ll i=(a);i<(b);++i)
#define F0Rrev(i,N) for(int i=(N);i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define dbgLine cerr<<" LINE : "<<__LINE__<<"\n"
#define ldd long double

using namespace std;

/*
const int Alp = 26;
const int __PRECISION = 9;
const int inf = 1e9 + 8;

const ldd PI = acos(-1);
const ldd EPS = 1e-7;

const ll MOD = 1e9 + 7;
const ll MAXN = 2e5 + 5;
const ll ROOTN = 320;
const ll LOGN = 18;
const ll INF = 1e18 + 1022;
*/

bool cross(pll a, pll b, pll c)	{return 1LL*(a.ff - b.ff)*(b.ss - c.ss) >= 1LL*(a.ss - b.ss)*(b.ff - c.ff);}

inline int maximum_deevs(vector<int> y)
{
	int ls, i, j, res, n = y.size();
	vector<vi> dp(2020, vi(2020));
	FOR(i, n)
	{
		dp[i][i] = dp[i][i+1] = 1;
		ls = i-1;
		res = 0;
		FORrev(j, i-2)
		{
			if(cross(mp(j,y[j]), mp(ls,y[ls]), mp(i, y[i])))
			{
				res += dp[j+1][ls-1];
				ls = j;
			}
			dp[j][i] = max(dp[j][i-1], 1 + res + dp[j][ls - 1]);
		}
	}
	return dp[0][n-1];
}
/*
signed main()
{

	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cout<<cross(mp(1,4), mp(2,2), mp(3,1))<<'\n';

	int test_case_number;
	cin>>test_case_number;
	vi y; int j;
	while(test_case_number--)
		cin>>j, y.pb(j);
	cout<<maximum_deevs(y)<<'\n';
	
	return 0;
}*/

Compilation message

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