結果

問題 No.205 マージして辞書順最小
ユーザー maimai
提出日時 2018-09-25 00:53:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 331 ms / 5,000 ms
コード長 250 bytes
コンパイル時間 410 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 16,284 KB
最終ジャッジ日時 2023-10-24 18:59:32
合計ジャッジ時間 4,249 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
16,056 KB
testcase_01 AC 87 ms
16,056 KB
testcase_02 AC 127 ms
16,152 KB
testcase_03 AC 132 ms
16,152 KB
testcase_04 AC 127 ms
16,152 KB
testcase_05 AC 124 ms
16,152 KB
testcase_06 AC 88 ms
16,056 KB
testcase_07 AC 194 ms
16,280 KB
testcase_08 AC 182 ms
16,280 KB
testcase_09 AC 188 ms
16,284 KB
testcase_10 AC 331 ms
16,280 KB
testcase_11 AC 295 ms
16,280 KB
testcase_12 AC 253 ms
16,280 KB
testcase_13 AC 196 ms
16,280 KB
testcase_14 AC 87 ms
16,056 KB
testcase_15 AC 86 ms
16,056 KB
testcase_16 AC 85 ms
16,056 KB
testcase_17 AC 85 ms
16,056 KB
testcase_18 AC 86 ms
16,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: assigned but unused variable - item
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i); end

strs = gets.to_i.times.map{(gets.chomp+'~').chars}

ans = ''
while !strs.empty?
    item, i = strs.each_with_index.min
    ans << strs[i].shift
    strs.delete_at(i) if strs[i].empty?
end

puts ans.gsub('~','')
0