답안 #917565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
917565 2024-01-28T12:20:07 Z 12345678 Candies (JOI18_candies) C++17
8 / 100
15 ms 32088 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=2e3+5;

ll n, a[nx], dp[nx][nx];

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i];
    for (int i=1; i<=n; i++) for (int j=0; j<=n; j++) dp[i][j]=LLONG_MIN;
    for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) dp[i][j]=max(dp[i][j-1], dp[i-1][max(0, j-2)]+a[j]);
    for (int i=1; i<=(n+1)/2; i++) cout<<dp[i][n]<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 31832 KB Output is correct
2 Correct 12 ms 31836 KB Output is correct
3 Correct 13 ms 31836 KB Output is correct
4 Correct 12 ms 31836 KB Output is correct
5 Correct 15 ms 31836 KB Output is correct
6 Correct 14 ms 31836 KB Output is correct
7 Correct 12 ms 31892 KB Output is correct
8 Correct 14 ms 31836 KB Output is correct
9 Correct 12 ms 31836 KB Output is correct
10 Correct 13 ms 31836 KB Output is correct
11 Correct 13 ms 31832 KB Output is correct
12 Correct 15 ms 31836 KB Output is correct
13 Correct 12 ms 31836 KB Output is correct
14 Correct 13 ms 31876 KB Output is correct
15 Correct 12 ms 31836 KB Output is correct
16 Correct 15 ms 32088 KB Output is correct
17 Correct 12 ms 31836 KB Output is correct
18 Correct 12 ms 31836 KB Output is correct
19 Correct 12 ms 31836 KB Output is correct
20 Correct 12 ms 31712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 31832 KB Output is correct
2 Correct 12 ms 31836 KB Output is correct
3 Correct 13 ms 31836 KB Output is correct
4 Correct 12 ms 31836 KB Output is correct
5 Correct 15 ms 31836 KB Output is correct
6 Correct 14 ms 31836 KB Output is correct
7 Correct 12 ms 31892 KB Output is correct
8 Correct 14 ms 31836 KB Output is correct
9 Correct 12 ms 31836 KB Output is correct
10 Correct 13 ms 31836 KB Output is correct
11 Correct 13 ms 31832 KB Output is correct
12 Correct 15 ms 31836 KB Output is correct
13 Correct 12 ms 31836 KB Output is correct
14 Correct 13 ms 31876 KB Output is correct
15 Correct 12 ms 31836 KB Output is correct
16 Correct 15 ms 32088 KB Output is correct
17 Correct 12 ms 31836 KB Output is correct
18 Correct 12 ms 31836 KB Output is correct
19 Correct 12 ms 31836 KB Output is correct
20 Correct 12 ms 31712 KB Output is correct
21 Runtime error 2 ms 604 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -