結果

問題 No.999 てん vs. ほむ
ユーザー lloyzlloyz
提出日時 2022-05-22 13:55:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 11,812 KB
実行使用メモリ 31,832 KB
最終ジャッジ日時 2023-10-20 16:59:56
合計ジャッジ時間 3,524 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,084 KB
testcase_01 AC 28 ms
10,084 KB
testcase_02 AC 28 ms
10,084 KB
testcase_03 AC 29 ms
10,084 KB
testcase_04 AC 29 ms
10,088 KB
testcase_05 AC 29 ms
10,096 KB
testcase_06 AC 28 ms
10,088 KB
testcase_07 AC 28 ms
10,092 KB
testcase_08 AC 33 ms
10,860 KB
testcase_09 AC 156 ms
30,308 KB
testcase_10 AC 68 ms
16,032 KB
testcase_11 AC 54 ms
13,840 KB
testcase_12 AC 87 ms
19,104 KB
testcase_13 AC 172 ms
31,832 KB
testcase_14 AC 172 ms
31,832 KB
testcase_15 AC 174 ms
31,832 KB
testcase_16 AC 175 ms
31,832 KB
testcase_17 AC 155 ms
31,244 KB
testcase_18 AC 150 ms
31,008 KB
testcase_19 AC 152 ms
31,212 KB
testcase_20 AC 154 ms
31,324 KB
testcase_21 AC 164 ms
31,768 KB
testcase_22 AC 160 ms
31,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

count = sum(A[::2]) - sum(A[1::2])
ans = count
for i in range(n - 1, -1, -1):
    count -= A[i * 2] * 2
    count += A[i * 2 + 1] * 2
    ans = max(ans, count)
print(ans)
0