Submission #557530

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5575302022-05-05 12:39:01AlexandruabcdeFeast (NOI19_feast)C++14
100 / 100
736 ms26912 KiB
#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()
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...