結果

問題 No.370 道路の掃除
ユーザー ciel
提出日時 2016-05-16 00:14:37
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 139 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-10-06 04:14:19
合計ジャッジ時間 4,023 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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|
e[0]*e[-1]<0 ? -e[0]+e[-1]+[-e[0],e[1]].min :
e[0]<0 ? -e[0] : e[-1]
}.min
0