結果

問題 No.45 回転寿司
ユーザー zimphazimpha
提出日時 2017-12-13 23:18:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 193 bytes
コンパイル時間 1,196 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 71,412 KB
最終ジャッジ日時 2023-08-27 15:53:14
合計ジャッジ時間 4,381 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,212 KB
testcase_01 AC 77 ms
71,168 KB
testcase_02 AC 78 ms
71,328 KB
testcase_03 AC 77 ms
71,220 KB
testcase_04 AC 74 ms
71,324 KB
testcase_05 AC 75 ms
71,052 KB
testcase_06 AC 76 ms
71,360 KB
testcase_07 AC 77 ms
71,036 KB
testcase_08 AC 76 ms
71,040 KB
testcase_09 AC 76 ms
71,360 KB
testcase_10 AC 78 ms
71,292 KB
testcase_11 AC 77 ms
71,212 KB
testcase_12 AC 75 ms
71,208 KB
testcase_13 AC 74 ms
71,144 KB
testcase_14 AC 75 ms
71,412 KB
testcase_15 AC 76 ms
71,220 KB
testcase_16 AC 75 ms
71,240 KB
testcase_17 AC 77 ms
71,268 KB
testcase_18 AC 75 ms
71,220 KB
testcase_19 AC 74 ms
71,236 KB
testcase_20 AC 75 ms
71,188 KB
testcase_21 AC 75 ms
70,996 KB
testcase_22 AC 75 ms
71,164 KB
testcase_23 AC 75 ms
71,312 KB
testcase_24 AC 75 ms
71,280 KB
testcase_25 AC 77 ms
71,164 KB
testcase_26 AC 76 ms
71,040 KB
testcase_27 AC 77 ms
71,240 KB
testcase_28 AC 78 ms
71,240 KB
testcase_29 AC 76 ms
71,228 KB
testcase_30 AC 76 ms
71,280 KB
testcase_31 AC 76 ms
70,996 KB
testcase_32 AC 75 ms
71,188 KB
testcase_33 AC 77 ms
71,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
v = list(map(int, input().split()))
f = [0] * n
g = [0] * n
f[0] = v[0]
for i in range(1, n):
  f[i] = g[i - 1] + v[i]
  g[i] = max(f[i - 1], g[i - 1])
print(max(f[-1], g[-1]))
0