Submission #1084855

#TimeUsernameProblemLanguageResultExecution timeMemory
1084855fyanAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; #define i32 int #define int int64_t #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() const int MXN=4e3+5, INF=1e9; int N,M,K; array<int,2> arr[MXN]; int dp[MXN][MXN]; bool cc1(const array<int,2> &a, const array<int,2> &b) { if (a[0]==b[0]) { return a[1]>b[1]; } return a[0]<b[0]; } bool cc2(const array<int,2> &a, const array<int,2> &b) { return a[1]<b[1]; } int take_photos(i32 n, i32 m, i32 k, vector<i32> r, vector<i32> c) { N = n, M = m, K = min(k,N); for (int i=1; i<=N; i++) { arr[i] = {min(r[i-1],c[i-1]),max(r[i-1],c[i-1])}; } arr[0] = {-INF,-INF}; sort(arr,arr+N+1,cc1); int pv = 0,sub = 0; for (int i=1; i<=N; i++) { if (arr[pv][1] >= arr[i][1]) { sub++; arr[i] = {INF,INF}; } else pv = i; } sort(arr,arr+1+N,cc2); N -= sub; K = min(K,N); memset(dp,0x3f,sizeof(dp)); dp[0][0] = 0; for (int i=1; i<=N; i++) { for (int j=1; j<=K; j++) { for (int p=0; p<i; p++) { int area = (arr[i][1]-arr[p+1][0]+1)*(arr[i][1]-arr[p+1][0]+1); int dif = 1ll*max(0ll,arr[p][1]-arr[p+1][0]+1ll)*max(0ll,arr[p][1]-arr[p+1][0]+1ll); area -= dif; dp[i][j] = min(dp[i][j],dp[p][j-1]+area); } } } return dp[N][K]; } /* signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int a,b,c; cin>>a>>b>>c; vector<int> x(a),y(a); for (int i=0; i<a; i++) { cin>>x[i]>>y[i]; } cout<<take_photos(a,b,c,x,y); return 0; } */

Compilation message (stderr)

/usr/bin/ld: /tmp/ccZOURIP.o: in function `main':
grader.cpp:(.text.startup+0xf0): 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