Submission #51852

# Submission time Handle Problem Language Result Execution time Memory
51852 2018-06-22T02:52:47 Z zetapi Aliens (IOI16_aliens) C++14
Compilation error
0 ms 0 KB
//#include "aliens.h"
#include "bits/stdc++.h"
using namespace std;

#define pb  push_back
#define mp  make_pair
#define int long long
#define itr ::iterator 

typedef pair<int,int>  pii;

const int MAX=1e5;
const int INF=1e12;

vector<pii> vec;

bool cmp(pii X,pii Y)
{
	return X.second<Y.second;
}

int cost(int X,int Y)
{
	return (vec[Y-1].second-vec[X-1].first)*(vec[Y-1].second-vec[X-1].first);
}

long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) 
{
	int N=n,M=m,K=k,dp[n+99][k+99];
	for(int A=0;A<n;A++)
		vec.pb(mp(r[A],r[A]+abs(r[A]-c[A])));
	sort(vec.begin(),vec.end(),cmp);
	for(int A=0;A<=N;A++)
		for(int B=0;B<=K;B++)
			dp[A][B]=INF;
	dp[0][0]=0;
	for(int A=1;A<=N;A++)
	{
		dp[A][0]=0;
		for(int B=0;B<A;B++)
			for(int C=1;C<=K;C++)
				dp[A][C]=min(dp[A][C],dp[B][C-1]+cost(B+1,A));
	}
    return dp[N][K];
}

Compilation message

aliens.cpp: In function 'long long int take_photos(long long int, long long int, long long int, std::vector<long long int>, std::vector<long long int>)':
aliens.cpp:29:10: warning: unused variable 'M' [-Wunused-variable]
  int N=n,M=m,K=k,dp[n+99][k+99];
          ^
/tmp/ccrGboEY.o: In function `main':
grader.cpp:(.text.startup+0xdf): undefined reference to `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status