結果

問題 No.999 てん vs. ほむ
ユーザー ValkyrjaValkyrja
提出日時 2020-05-16 16:05:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 11,812 KB
実行使用メモリ 32,712 KB
最終ジャッジ日時 2023-10-23 17:43:19
合計ジャッジ時間 6,450 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,016 KB
testcase_01 AC 31 ms
10,016 KB
testcase_02 AC 30 ms
10,016 KB
testcase_03 AC 30 ms
10,016 KB
testcase_04 AC 30 ms
10,024 KB
testcase_05 AC 31 ms
10,032 KB
testcase_06 AC 30 ms
10,024 KB
testcase_07 AC 30 ms
10,028 KB
testcase_08 AC 37 ms
10,800 KB
testcase_09 AC 215 ms
30,244 KB
testcase_10 AC 84 ms
15,968 KB
testcase_11 AC 67 ms
14,064 KB
testcase_12 AC 111 ms
19,040 KB
testcase_13 AC 233 ms
31,764 KB
testcase_14 AC 232 ms
31,764 KB
testcase_15 AC 230 ms
31,764 KB
testcase_16 AC 235 ms
31,764 KB
testcase_17 AC 216 ms
32,712 KB
testcase_18 AC 200 ms
30,944 KB
testcase_19 AC 208 ms
32,444 KB
testcase_20 AC 207 ms
31,272 KB
testcase_21 AC 206 ms
31,704 KB
testcase_22 AC 205 ms
31,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=[int(j)for j in input().split()]
l=[0,a[0]-a[1]]
for i in range(1,n):
    l.append(l[-1]+a[2*i]-a[2*i+1])
a=a[::-1]
r=[a[0]-a[1]]
for i in range(1,n):
    r.append(r[-1]+a[2*i]-a[2*i+1])
r=r[::-1]+[0]
ans=0
for i in range(n+1):
    ans=max(ans,l[i]+r[i])
print(ans)
0