結果

問題 No.370 道路の掃除
ユーザー Tatsuno
提出日時 2016-05-14 01:24:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 333 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-05 20:59:56
合計ジャッジ時間 2,138 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a,b=[],[]
for i in range(m):
    d = int(input())
    if d < 0:
        a.append(abs(d))
    else:
        b.append(d)
a.sort()
b.sort()
ans = 30000
for i in range(max(min(len(a),n),1)):
    l=0 if i < 1 else max(a[0:i])
    r=0 if n-i < 1 else max(b[0:n-i])
    ans = min(ans,  l+r+min(l,r))
print(ans)
0