結果

問題 No.45 回転寿司
ユーザー TomoyarnTomoyarn
提出日時 2023-09-18 16:52:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 286 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 75,572 KB
最終ジャッジ日時 2023-09-18 16:52:46
合計ジャッジ時間 4,814 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
75,308 KB
testcase_01 AC 79 ms
75,312 KB
testcase_02 AC 82 ms
75,508 KB
testcase_03 AC 81 ms
75,432 KB
testcase_04 AC 80 ms
75,320 KB
testcase_05 AC 78 ms
75,216 KB
testcase_06 AC 80 ms
75,240 KB
testcase_07 AC 82 ms
75,256 KB
testcase_08 AC 76 ms
75,332 KB
testcase_09 AC 82 ms
75,248 KB
testcase_10 AC 77 ms
75,272 KB
testcase_11 AC 75 ms
75,260 KB
testcase_12 AC 79 ms
75,324 KB
testcase_13 AC 74 ms
75,248 KB
testcase_14 AC 76 ms
75,136 KB
testcase_15 AC 79 ms
75,312 KB
testcase_16 AC 79 ms
75,420 KB
testcase_17 AC 81 ms
75,232 KB
testcase_18 AC 78 ms
75,196 KB
testcase_19 AC 81 ms
75,264 KB
testcase_20 AC 75 ms
75,136 KB
testcase_21 AC 76 ms
75,220 KB
testcase_22 AC 75 ms
71,096 KB
testcase_23 AC 72 ms
71,244 KB
testcase_24 AC 74 ms
71,424 KB
testcase_25 AC 75 ms
71,212 KB
testcase_26 AC 80 ms
75,256 KB
testcase_27 AC 82 ms
75,224 KB
testcase_28 AC 80 ms
75,272 KB
testcase_29 AC 93 ms
75,572 KB
testcase_30 AC 82 ms
75,288 KB
testcase_31 AC 72 ms
71,568 KB
testcase_32 AC 73 ms
71,096 KB
testcase_33 AC 83 ms
75,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = list(map(int, input().split()))

dp = [[0 for _ in range(N + 1)] for _ in range(N)]

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

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

    
0