| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 172301 | arnold518 | Candies (JOI18_candies) | C++14 | 35 ms | 31996 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 2000;
const ll INF = 1e16;
int N, A[MAXN+10];
ll dp[MAXN+10][MAXN+10];
int main()
{
int i, j;
scanf("%d", &N);
for(i=1; i<=N; i++) scanf("%d", &A[i]);
for(i=0; i<=N; i++) for(j=0; j<=N; j++) dp[i][j]=-INF;
dp[1][1]=A[1];
for(i=0; i<=N; i++) dp[i][0]=0;
for(i=2; i<=N; i++)
{
for(j=1; j<=(N+1)/2; j++)
{
dp[i][j]=max(dp[i-1][j], dp[i-2][j-1]+A[i]);
}
}
for(i=1; i<=(N+1)/2; i++) printf("%lld\n", dp[N][i]);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
