# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1123013 | Monchito | Feast (NOI19_feast) | C++20 | 552 ms | 40320 KiB |
#include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define fore(i,a,b) for(auto i=a; i<b; i++)
#define forn(i,n) fore(i,0,n)
typedef long long ll;
const int MAXN = 3e5+10;
const ll INF = 1e15;
int n, k;
ll a[MAXN], lambda;
ll dp[MAXN][2], cnt[MAXN][2];
ll solve(int i, int flag){
if(i==n) return cnt[i][flag]=0;
ll& ret = dp[i][flag];
if(ret != -1) return ret;
cnt[i][flag]=0;
if(flag==0){
ret = solve(i+1,0);
cnt[i][flag]=cnt[i+1][flag];
if(ret < solve(i,1)-lambda){
ret = solve(i,1)-lambda;
cnt[i][flag] = 1 + cnt[i][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... |