結果
問題 |
No.999 てん vs. ほむ
|
ユーザー |
![]() |
提出日時 | 2020-05-14 17:00:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 259 bytes |
コンパイル時間 | 413 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 32,644 KB |
最終ジャッジ日時 | 2024-09-15 11:32:14 |
合計ジャッジ時間 | 4,652 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 12 |
ソースコード
n=int(input()) a=[int(j) for j in input().split()] from collections import deque q=deque(a) ans=0 for i in range(n): if q[0]-q[1]>q[-1]-q[-2]: ans+=q.popleft() ans-=q.popleft() else: ans+=q.pop() ans-=q.pop() print(ans)