結果

問題 No.999 てん vs. ほむ
ユーザー akanayaakanaya
提出日時 2020-04-03 15:58:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 105,116 KB
最終ジャッジ日時 2023-09-15 23:35:55
合計ジャッジ時間 3,882 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,320 KB
testcase_01 AC 68 ms
71,400 KB
testcase_02 AC 69 ms
71,348 KB
testcase_03 AC 69 ms
71,268 KB
testcase_04 AC 69 ms
71,608 KB
testcase_05 AC 70 ms
71,272 KB
testcase_06 AC 70 ms
71,376 KB
testcase_07 AC 70 ms
71,312 KB
testcase_08 AC 82 ms
76,736 KB
testcase_09 AC 128 ms
103,000 KB
testcase_10 AC 93 ms
83,060 KB
testcase_11 AC 88 ms
80,420 KB
testcase_12 AC 102 ms
88,176 KB
testcase_13 AC 131 ms
104,912 KB
testcase_14 AC 131 ms
105,064 KB
testcase_15 AC 133 ms
104,884 KB
testcase_16 AC 133 ms
105,116 KB
testcase_17 AC 122 ms
101,700 KB
testcase_18 AC 123 ms
101,588 KB
testcase_19 AC 121 ms
101,608 KB
testcase_20 AC 122 ms
101,684 KB
testcase_21 AC 129 ms
104,808 KB
testcase_22 AC 129 ms
104,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a2n = list(map(int, input().split(' ')))

fromL = [None] * n
for i in range(n):
    fromL[i] = a2n[2 * i] - a2n[2 * i + 1]

fromR = [None] * n
a2nd = a2n[::-1]
for i in range(n):
    fromR[i] = a2nd[2 * i] - a2nd[2 * i + 1]

cumL = [None] * (n + 1)
cumL[0] = 0
for i in range(n):
    cumL[i + 1] = cumL[i] + fromL[i]

cumR = [None] * (n + 1)
cumR[0] = 0
for i in range(n):
    cumR[i + 1] = cumR[i] + fromR[i]


results = [None] * (n + 1)
for i in range(n + 1):
   results[i] = cumR[i]+ cumL[n - i]

print(max(results))



0