結果

問題 No.45 回転寿司
ユーザー brthyyjpbrthyyjp
提出日時 2020-10-23 03:10:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 5,000 ms
コード長 246 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2023-09-28 15:00:44
合計ジャッジ時間 4,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,120 KB
testcase_01 AC 84 ms
76,368 KB
testcase_02 AC 86 ms
76,284 KB
testcase_03 AC 91 ms
76,144 KB
testcase_04 AC 86 ms
76,020 KB
testcase_05 AC 84 ms
75,636 KB
testcase_06 AC 84 ms
76,216 KB
testcase_07 AC 86 ms
76,028 KB
testcase_08 AC 84 ms
76,148 KB
testcase_09 AC 86 ms
75,876 KB
testcase_10 AC 84 ms
75,872 KB
testcase_11 AC 84 ms
76,416 KB
testcase_12 AC 84 ms
76,112 KB
testcase_13 AC 81 ms
75,716 KB
testcase_14 AC 82 ms
75,844 KB
testcase_15 AC 85 ms
75,980 KB
testcase_16 AC 83 ms
76,064 KB
testcase_17 AC 83 ms
75,984 KB
testcase_18 AC 84 ms
76,144 KB
testcase_19 AC 84 ms
76,004 KB
testcase_20 AC 80 ms
75,588 KB
testcase_21 AC 83 ms
75,808 KB
testcase_22 AC 78 ms
71,224 KB
testcase_23 AC 77 ms
71,328 KB
testcase_24 AC 78 ms
71,140 KB
testcase_25 AC 77 ms
70,988 KB
testcase_26 AC 85 ms
75,928 KB
testcase_27 AC 88 ms
76,188 KB
testcase_28 AC 86 ms
75,980 KB
testcase_29 AC 82 ms
76,116 KB
testcase_30 AC 85 ms
76,016 KB
testcase_31 AC 75 ms
71,204 KB
testcase_32 AC 74 ms
71,248 KB
testcase_33 AC 84 ms
76,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if n == 1:
    print(V[0])
    exit()

dp = [0]*n
dp[0] = V[0]
for i in range(1, n):
    dp[i] = V[i]
    for j in range(i-1):
        dp[i] = max(dp[i], dp[j]+V[i])
#print(dp)
print(max(dp))
0