結果

問題 No.370 道路の掃除
ユーザー akitsugu777
提出日時 2019-07-26 15:43:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 238 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-02 06:29:42
合計ジャッジ時間 2,879 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int,input().split())
D = [int(input()) for _ in range(M)]

C = 0
P = 0
while N > 0:
    L = []
    for i in D:
        L.append(abs(P - i))
    
    X = min(L)
    Y = L.index(X)
    P = D.pop(Y)
    N -= 1
    C += X

print(C)
0