結果
問題 |
No.999 てん vs. ほむ
|
ユーザー |
|
提出日時 | 2022-05-22 13:51:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 299 bytes |
コンパイル時間 | 353 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 32,760 KB |
最終ジャッジ日時 | 2024-09-20 12:33:38 |
合計ジャッジ時間 | 4,417 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 12 |
ソースコード
from collections import deque n = int(input()) A = deque(map(int, input().split())) ans = 0 for _ in range(n): if A[0] - A[1] >= A[-1] - A[-2]: ans += A[0] - A[1] A.popleft() A.popleft() else: ans += A[-1] - A[-2] A.pop() A.pop() print(ans)