結果

問題 No.628 Tagの勢い
ユーザー mai
提出日時 2018-01-05 21:27:41
言語 Ruby
(3.4.1)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-10-07 22:03:54
合計ジャッジ時間 2,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:6: warning: assigned but unused variable - no
Main.rb:7: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

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

sc = {}

gets.to_i.times do
    no = gets.to_i
    m,s = ascan
    tags = gets.chomp.split
    
    tags.each do |tag|
        sc[tag] ||= 0
        sc[tag] -= s
    end
end

limit = 10
sc.to_a.map(&:reverse).sort.each do |s, tag|
    break if limit == 0
    limit -= 1
    puts "#{tag} #{-s}"
end
0