Submission #469046

#TimeUsernameProblemLanguageResultExecution timeMemory
469046flashmtAliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const long long oo = 1LL << 60; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<int> id(n); for (int i = 0; i < n; i++) { if (r[i] > c[i]) swap(r[i], c[i]); id[i] = i; } sort(begin(id), end(id), [&](int u, int v) { return r[u] + c[u] < r[v] + c[v]; }); vector<vector<long long>> f(n + 1, vector<long long>(n + 1, oo)); f[0][0] = 0; for (int i = 1; i <= k; i++) for (int j = 1; j <= n; j++) { f[i][j] = oo; int minX = n, maxY = -1; for (int jj = j - 1; jj >= 0; jj--) { minX = min(minX, r[id[jj]]); maxY = max(maxY, c[id[jj]]); int area = (maxY - minX + 1LL) * (maxY - minX + 1); f[i][j] = min(f[i][j], f[i - 1][jj] + area); } } long long ans = oo; for (int i = 1; i <= k; i++) ans = min(ans, f[i][n]); return ans; } int main() { int n, m, k; assert(3 == scanf("%d %d %d", &n, &m, &k)); std::vector<int> r(n), c(n); for (int i = 0; i < n; i++) { assert(2 == scanf("%d %d", &r[i], &c[i])); } long long ans = take_photos(n, m, k, r, c); cout << ans << endl; }

Compilation message (stderr)

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