結果

問題 No.3066 Collecting Coins Speedrun 1
ユーザー Aralov Otabek
提出日時 2025-05-20 16:13:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 82,432 KB
最終ジャッジ日時 2025-05-20 16:13:49
合計ジャッジ時間 4,739 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other AC * 6 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def minimal_walk_distance(n, coins):
    leftmost = min(coins)
    rightmost = max(coins)


    route1 = (rightmost - leftmost) + min(abs(leftmost), abs(rightmost))

    return 2 * (rightmost - leftmost) + min(abs(leftmost), abs(rightmost))

n = int(input())
coins = list(map(int, input().split()))

print(minimal_walk_distance(n, coins))
0