結果

問題 No.999 てん vs. ほむ
ユーザー hir355hir355
提出日時 2020-04-03 17:38:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 30,304 KB
最終ジャッジ日時 2023-09-15 23:44:51
合計ジャッジ時間 3,866 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,856 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 16 ms
7,812 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 15 ms
7,848 KB
testcase_05 AC 16 ms
7,876 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 16 ms
7,836 KB
testcase_08 AC 20 ms
8,916 KB
testcase_09 AC 163 ms
28,176 KB
testcase_10 AC 61 ms
14,072 KB
testcase_11 AC 45 ms
12,052 KB
testcase_12 AC 79 ms
17,236 KB
testcase_13 AC 176 ms
29,872 KB
testcase_14 AC 177 ms
29,920 KB
testcase_15 AC 173 ms
29,840 KB
testcase_16 AC 174 ms
29,900 KB
testcase_17 AC 156 ms
29,376 KB
testcase_18 AC 155 ms
28,952 KB
testcase_19 AC 157 ms
30,304 KB
testcase_20 AC 158 ms
29,328 KB
testcase_21 AC 157 ms
29,904 KB
testcase_22 AC 158 ms
29,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
t = 0
for i in range(n - 1, -1, -1):
    t += a[i * 2 + 1] - a[i * 2]
ans = t
for i in range(n):
    t += (a[i * 2] - a[i * 2 + 1]) * 2
    ans = max(ans, t)
print(ans)
0