Submission #761720

# Submission time Handle Problem Language Result Execution time Memory
761720 2023-06-20T07:48:23 Z Dan4Life Aliens (IOI16_aliens) C++17
Compilation error
0 ms 0 KB
//#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
using ll = long long;
using ar = array<int,2>;

ll take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
	for(int i = 0; i < n; i++)
		if(c[i]-r[i]<0) r[i]=m-r[i]-1,c[i]=m-c[i]-1;
	vector<ar> v,w; set<int> S;
	for(int i = 0; i < n; i++) w.pb({c[i],r[i]});
	sort(begin(w),end(w));
	for(int i = n-1; i >=0; i--){
		if(!sz(S) or *begin(S) > w[i][1]) v.pb(w[i]);
		S.insert(w[i][1]);
	}
	n = sz(v); ll dp[n+1][k+1];
	memset(dp,63,sizeof(dp)); dp[0][0] = 0;
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= k; j++)
			for(int x = 0; x < i; x++)
				dp[i][j] = min(dp[i][j],
					dp[x][j-1]+(v[i-1][0]-v[x][1]+1)*(v[i-1][0]-v[x][1]+1));
    return dp[n][k];
}

int main(){
    int n, m, k;
    assert(3 == scanf("%d %d %d", &n, &m, &k));
    vector<int> r(n), c(n);
    for (int i = 0; i < n; i++)
        assert(2 == scanf("%d %d", &r[i], &c[i]));
    printf("%lld\n", take_photos(n, m, k, r, c));
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/cc37IqaJ.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccszXPgH.o:aliens.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status