結果

問題 No.370 道路の掃除
ユーザー ciel
提出日時 2016-05-16 00:23:24
言語 Ruby
(3.4.1)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 121 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2024-12-26 06:10:01
合計ジャッジ時間 5,253 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

n,m,*d=$<.read.split.map &:to_i
d.sort!
p d.each_cons(n).map{|e|
x,y=e[0],e[-1]
y<0 ? -x : x>0 ? y : y-x+[y,-x].min
}.min
0