結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2020-02-08 12:57:46 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 98 ms / 2,000 ms |
コード長 | 382 bytes |
コンパイル時間 | 51 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-25 08:48:46 |
合計ジャッジ時間 | 2,701 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
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[0, 10].each do |score| puts "#{score[0]} #{score[1]}" end