# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
435845 | Hegdahl | Aliens (IOI16_aliens) | C++17 | 2067 ms | 6988 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "aliens.h"
#define ar array
using namespace std;
using ll = long long;
int n, m, k;
vector<ar<ll, 2>> a;
const ll INF = 1LL<<60;
ll sq(ll a) { return a*a; }
void minset(ll &p, ll v) { if (v < p) p = v; }
ll solve() {
vector<vector<ll>> dp(n+1, vector<ll>(k+1, INF));
dp[0][0] = 0;
for (int kk = 0; kk < k; ++kk) {
for (int i = 0; i < n; ++i) {
int pr = i==0 ? -1 : a[i-1][1];
int l = a[i][0], r = a[i][1];
for (int j = i+1; j <= n; ++j) {
r = a[j-1][1];
minset(dp[j][kk+1], dp[i][kk] + sq(r-l+1) - sq(max(0, pr-l+1)));
}
}
# | 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... |