結果
問題 |
No.205 マージして辞書順最小
|
ユーザー |
|
提出日時 | 2018-09-25 00:39:38 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 407 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 20,256 KB |
最終ジャッジ日時 | 2024-09-24 17:31:16 |
合計ジャッジ時間 | 26,076 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | AC * 3 WA * 3 TLE * 2 -- * 7 |
コンパイルメッセージ
Main.rb:10: warning: assigned but unused variable - item Syntax OK
ソースコード
def ascan; gets.split.map(&:to_i); end strs_t = gets.to_i.times.map{gets.chomp} best = 'z'*250 400.times do ans = '' strs = strs_t.map{|l| l.chars} while !strs.empty? item, i = strs.each_with_index.min{|a,b| a[0][0] == b[0][0] ? rand(-1..1) : a[0][0] <=> b[0][0]} ans << strs[i].shift strs.delete_at(i) if strs[i].empty? end best = [ans,best].min end puts best