結果

問題 No.45 回転寿司
ユーザー _manji0_manji0
提出日時 2022-01-14 02:19:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 264 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 82,588 KB
実行使用メモリ 62,108 KB
最終ジャッジ日時 2024-04-29 06:29:18
合計ジャッジ時間 2,795 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
59,648 KB
testcase_01 AC 48 ms
59,904 KB
testcase_02 AC 48 ms
59,776 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 44 ms
58,752 KB
testcase_06 AC 48 ms
60,288 KB
testcase_07 WA -
testcase_08 AC 46 ms
60,032 KB
testcase_09 AC 51 ms
59,648 KB
testcase_10 AC 45 ms
59,904 KB
testcase_11 AC 45 ms
59,648 KB
testcase_12 WA -
testcase_13 AC 43 ms
58,752 KB
testcase_14 WA -
testcase_15 AC 45 ms
60,032 KB
testcase_16 AC 47 ms
60,032 KB
testcase_17 AC 45 ms
60,160 KB
testcase_18 AC 46 ms
59,648 KB
testcase_19 AC 47 ms
60,416 KB
testcase_20 AC 41 ms
57,856 KB
testcase_21 AC 44 ms
58,880 KB
testcase_22 AC 37 ms
52,096 KB
testcase_23 AC 39 ms
51,456 KB
testcase_24 AC 39 ms
51,712 KB
testcase_25 AC 38 ms
51,712 KB
testcase_26 AC 46 ms
59,648 KB
testcase_27 AC 48 ms
59,904 KB
testcase_28 AC 46 ms
60,288 KB
testcase_29 WA -
testcase_30 AC 46 ms
59,648 KB
testcase_31 AC 38 ms
51,840 KB
testcase_32 WA -
testcase_33 AC 49 ms
59,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = [ int(i) for i in input().split() ]

if N == 1:
    print(V[0])
else:
    dp = [0] * N

    dp[0] = V[0]
    dp[1] = V[1]

    for i in range(N-2):
        for j in range(i+2,N):
            dp[j] = max(dp[j], dp[i] + V[j])

    print(dp[N-1])
0