結果

問題 No.999 てん vs. ほむ
ユーザー tktk_snsn
提出日時 2021-04-28 01:20:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 295 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,896 KB
最終ジャッジ日時 2024-07-06 20:39:31
合計ジャッジ時間 3,001 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N = int(input())
A = tuple(map(int, input().split()))

ans = 0
head = 0
tail = 2*N-1
while tail > head:
    x = A[head] - A[head+1]
    y = A[tail] - A[tail-1]
    if x > y:
        ans += x
        head += 2
    else:
        ans += y
        tail -= 2
print(ans)
0