# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
701343 | Do_you_copy | K blocks (IZhO14_blocks) | C++17 | 1094 ms | 79432 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>
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define int long long
using namespace std;
using ll = long long;
using pii = pair <int, int>;
const int maxN = 1e5 + 1;
const int inf = 0x3f3f3f3f3f3f3f3f;
//const int Mod =
int n, k;
int a[maxN];
ll dp[maxN][101];
void Init(){
cin >> n >> k;
memset(dp, 0x3f, sizeof(dp));
for (int i = 1; i <= n; ++i){
cin >> a[i];
}
dp[0][0] = 0;
for (int i = 1; i <= k; ++i){
for (int j = 1; j <= n; ++j){
int maxx = 0;
for (int g = j; g >= 1; --g){
maxx = max(maxx, a[g]);
dp[j][i] = min(dp[j][i], dp[g - 1][i - 1] + maxx);
}
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... |