結果
問題 |
No.628 Tagの勢い
|
ユーザー |
![]() |
提出日時 | 2020-02-08 12:56:55 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 375 bytes |
コンパイル時間 | 54 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-09-25 08:48:43 |
合計ジャッジ時間 | 2,767 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 13 |
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - m Syntax OK
ソースコード
n = gets.chomp.to_i scores = {} n.times do gets.chomp.to_i m, s = gets.chomp.split.map(&:to_i) t = gets.chomp.split t.each do |ti| scores[ti] ||= 0 scores[ti] += s end end scores = scores.sort do |a, b| if a[1] > b[1] -1 elsif a[1] < b[1] 1 else a[0] < b[0] ? -1 : 1 end end scores.each do |score| puts "#{score[0]} #{score[1]}" end