結果

問題 No.999 てん vs. ほむ
ユーザー komkompikomkompi
提出日時 2020-03-08 10:03:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,648 KB
最終ジャッジ日時 2024-04-24 12:17:57
合計ジャッジ時間 4,722 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 30 ms
10,880 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 35 ms
11,520 KB
testcase_09 AC 200 ms
30,616 KB
testcase_10 AC 83 ms
16,544 KB
testcase_11 AC 64 ms
14,680 KB
testcase_12 AC 106 ms
19,412 KB
testcase_13 AC 219 ms
32,520 KB
testcase_14 AC 217 ms
32,528 KB
testcase_15 AC 219 ms
32,544 KB
testcase_16 AC 218 ms
32,648 KB
testcase_17 AC 202 ms
29,104 KB
testcase_18 AC 199 ms
28,816 KB
testcase_19 AC 203 ms
29,084 KB
testcase_20 AC 205 ms
29,272 KB
testcase_21 AC 193 ms
32,136 KB
testcase_22 AC 191 ms
31,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))

fro=[A[2*i]-A[2*i+1] for i in range(N)]
back=[-A[2*i]+A[2*i+1] for i in range(N)]

temp=sum(fro)
ans=temp
for i in range(N)[::-1]:
    temp+=back[i]-fro[i]
    ans=max(ans,temp)
    
print(ans)
0