# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778852 | doowey | Feast (NOI19_feast) | C++14 | 130 ms | 10412 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 long ll;
typedef pair<ll, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = (int)3e5 + 10;
const ll inf = (ll)1e18;
ll P[N];
pii dp[N];
int n;
void compute(ll penalty){
for(int i = 1 ; i <= n; i ++ ){
dp[i]=mp(-inf,0);
}
pii cur=mp(dp[0].fi-P[0]-penalty, 1);
for(int i = 1; i <= n; i ++ ){
dp[i]=max(dp[i-1],mp(cur.fi+P[i],cur.se));
cur=max(cur,mp(dp[i].fi-P[i]-penalty,dp[i].se+1));
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |