# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28334 | laaS (#68) | Wine Tasting (FXCUP2_wine) | C++14 | 0 ms | 2020 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<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
vector<vector<int>> arr(k);
arr[0].resize(n);
for (int i = 0; i < n; i++)
cin >> arr[0][i];
int temp;
for (int i = 1; i < k; i++)
{
arr[i].resize(n, 0);
for (int j = i; j < n; j++)
{
for (int k = i - 1; k < j; k++)
{
temp = arr[i - 1][k];
if (arr[0][k] < arr[0][j])
temp += arr[0][j] - arr[0][k];
arr[i][j] = max(arr[i][j], temp);
}
}
}
temp = arr[k - 1][0];
for (int i = 1; i < n; i++)
temp = max(temp, arr[k - 1][i]);
cout << temp;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |