結果

問題 No.999 てん vs. ほむ
ユーザー s_shoheis_shohei
提出日時 2020-06-11 19:13:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 119,084 KB
最終ジャッジ日時 2023-09-06 08:27:54
合計ジャッジ時間 5,611 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,280 KB
testcase_01 AC 67 ms
71,440 KB
testcase_02 AC 67 ms
71,428 KB
testcase_03 AC 68 ms
71,468 KB
testcase_04 AC 69 ms
71,256 KB
testcase_05 WA -
testcase_06 AC 69 ms
71,552 KB
testcase_07 AC 70 ms
71,260 KB
testcase_08 AC 78 ms
76,408 KB
testcase_09 AC 137 ms
113,848 KB
testcase_10 AC 89 ms
86,468 KB
testcase_11 AC 85 ms
81,604 KB
testcase_12 AC 101 ms
93,820 KB
testcase_13 AC 144 ms
119,084 KB
testcase_14 AC 145 ms
118,980 KB
testcase_15 AC 146 ms
118,896 KB
testcase_16 AC 146 ms
118,844 KB
testcase_17 AC 124 ms
109,508 KB
testcase_18 WA -
testcase_19 AC 122 ms
109,708 KB
testcase_20 WA -
testcase_21 AC 143 ms
118,720 KB
testcase_22 AC 145 ms
118,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

lis=[]
for i in range(n):
    dif = a[2*i] - a[2*i+1]
    lis.append(dif)

l_lis=[0]
now=0
for i in range(len(lis)):
    now+=lis[i]
    l_lis.append(now)

r_lis=[0]
now=0
for i in reversed(range(len(lis))):
    now+=lis[i]
    r_lis.append(now)
r_lis.reverse()

ans=-10**20
for i in range(len(lis)):
    ans = max(ans,l_lis[i] - r_lis[i])
print(ans)
0