| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 759774 | jay_jayjay | Feast (NOI19_feast) | C++14 | 132 ms | 262144 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// {{{1
extern "C" int __lsan_is_turned_off() { return 1; }
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <iostream>
#include <deque>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
#define infl 0x3f3f3f3f3f3f3f3f
#define ninf 0xbebebebe
#define ninfl 0xbebebebebebebebe
#ifdef DEBUG
#define dprintf(args...) fprintf(stderr,args)
#include <assert.h>
#endif
#ifndef DEBUG
#define dprintf(args...) 69
#define assert(args...) 42
#endif
// 1}}}
int main()
{
        int n,nk;scanf("%d %d",&n,&nk);
        //printf("n=%d nk=%d\n",n,nk);
        vector<int> a(n);for(auto&x:a)scanf("%d",&x);
        vector<vector<ll>> dp(nk+1, vector<ll>(n,0));
        for(int i=0;i<n;i++)dp[0][i] = 0;
        for(int k=1;k<=nk;k++) {
                ll x=0;
                for(int i=0;i<n;i++) {
                        if(i)x = max(x,dp[k-1][i-1]);
                        //printf("x=%lld a[i]=%d\n",x,a[i]);
                        dp[k][i] = (x += a[i]);
                        if(i) dp[k][i] = max(dp[k][i],dp[k][i-1]);
                        else dp[k][i] = max(0ll,dp[k][i]);
                        //printf("dp[%d][%d]=%lld\n",k,i,dp[k][i]);
                }
        }
        //for(int k=0;k<nk;k++)printf("%lld\n",dp[k][n-1]);
        for(int k=1;k<nk;k++) assert(dp[k][n-1]-dp[k-1][n-1]>=dp[k+1][n-1]-dp[k][n-1]);
        printf("%lld\n",dp[nk][n-1]);
}
컴파일 시 표준 에러 (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... | ||||
