# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557530 | Alexandruabcde | Feast (NOI19_feast) | C++14 | 736 ms | 26912 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>
using namespace std;
typedef long double LD;
typedef long long LL;
typedef pair <LD, int> PLDI;
constexpr int NMAX = 3e5 + 5;
constexpr LD INF = 1LL * 1e14;
int N, K;
LD A[NMAX];
PLDI dp[NMAX][2];
PLDI Check (LD penalty) {
dp[1][0] = {0, 0};
dp[1][1] = {A[1] - penalty, 1};
for (int i = 2; i <= N; ++ i ) {
dp[i][0] = max(dp[i-1][0], dp[i-1][1]);
dp[i][1] = max(make_pair(dp[i-1][0].first + A[i] - penalty, dp[i-1][0].second + 1),
make_pair(dp[i-1][1].first + A[i], dp[i-1][1].second));
}
return max(dp[N][0], dp[N][1]);
}
int main()
{
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |