結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-15 00:51:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 323 bytes |
| コンパイル時間 | 279 ms |
| コンパイル使用メモリ | 82,384 KB |
| 実行使用メモリ | 113,692 KB |
| 最終ジャッジ日時 | 2024-09-20 01:12:06 |
| 合計ジャッジ時間 | 3,228 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | WA * 20 |
ソースコード
from collections import deque
N = int(input())
A = list(map(int,input().split()))
if N == 1:
print(max(A)-min(A))
exit()
B = []
for i in range(0,2*N-1,2):
B.append(A[i]-A[i+1])
B = deque(B)
ans = 0
print(B)
while B:
if B[0] >= -B[-1]:
ans += B.popleft()
else:
ans += -B.pop()
print(ans)