結果
問題 | No.3042 本棚 |
ユーザー | takumi-onisi |
提出日時 | 2021-04-24 14:15:29 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 704 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 11,376 KB |
実行使用メモリ | 15,388 KB |
最終ジャッジ日時 | 2023-09-17 13:35:44 |
合計ジャッジ時間 | 3,696 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
15,160 KB |
testcase_01 | AC | 82 ms
15,004 KB |
testcase_02 | AC | 83 ms
14,996 KB |
testcase_03 | AC | 82 ms
15,324 KB |
testcase_04 | AC | 82 ms
15,312 KB |
testcase_05 | AC | 84 ms
15,276 KB |
testcase_06 | AC | 82 ms
15,088 KB |
testcase_07 | AC | 82 ms
15,104 KB |
testcase_08 | AC | 82 ms
15,388 KB |
testcase_09 | AC | 84 ms
15,284 KB |
testcase_10 | AC | 83 ms
15,308 KB |
testcase_11 | AC | 82 ms
15,328 KB |
testcase_12 | AC | 82 ms
15,284 KB |
testcase_13 | AC | 82 ms
15,256 KB |
testcase_14 | AC | 81 ms
15,224 KB |
testcase_15 | AC | 85 ms
15,100 KB |
testcase_16 | AC | 82 ms
15,268 KB |
testcase_17 | AC | 82 ms
15,128 KB |
testcase_18 | AC | 83 ms
15,256 KB |
testcase_19 | AC | 82 ms
15,308 KB |
testcase_20 | AC | 83 ms
15,380 KB |
testcase_21 | AC | 82 ms
15,108 KB |
testcase_22 | AC | 80 ms
15,328 KB |
testcase_23 | AC | 83 ms
15,040 KB |
testcase_24 | AC | 83 ms
15,272 KB |
testcase_25 | AC | 82 ms
15,044 KB |
testcase_26 | AC | 83 ms
15,116 KB |
コンパイルメッセージ
Syntax OK
ソースコード
books = gets.to_i.times.map{gets.split(" ")} series = ["iti", "ni", "san", "yon"] num_of_sorted_items = 0 books_last_index = books.length-1 while num_of_sorted_items < books_last_index do (1..books_last_index-num_of_sorted_items).each do |index| if books[index][0] < books[index-1][0] then books[index-1], books[index] = books[index], books[index-1] elsif books[index][0] == books[index-1][0] then if series.index(books[index][1]) < series.index(books[index-1][1]) books[index-1], books[index] = books[index], books[index-1] end end end num_of_sorted_items += 1 end books.each{|item| puts "#{item[0]}\s#{item[1]}"}