| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1325229 | caganyanmaz | Aliens (IOI16_aliens) | C++20 | 67 ms | 2360 KiB |
#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) {
assert(1 <= n && n <= 500);
assert(1 <= m && m <= 1000);
for (int i = 0; i < n; i++) {
assert(r[i] == c[i]);
}
vector<array<int, 2>> pos;
for (int i = 0; i < n; i++) {
pos.push_back({r[i], c[i]});
}
sort(pos.begin(), pos.end());
vector<vector<int>> dp(n+1, vector<int>(m+1, 1e9));
for (int j = 0; j <= k; j++) {
dp[0][j] = 0;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= k; j++) {
for (int t = 0; t < i; t++) {
int side_length = pos[i-1][0] - pos[t][0] + 1;
int area = side_length * side_length;
dp[i][j] = min(dp[i][j], dp[t][j-1] + area);
}
}
}
return dp[n][k];
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
