結果

問題 No.628 Tagの勢い
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-08 12:57:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 12,016 KB
実行使用メモリ 16,340 KB
最終ジャッジ日時 2023-10-26 00:49:19
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
16,220 KB
testcase_01 AC 83 ms
16,220 KB
testcase_02 AC 83 ms
16,220 KB
testcase_03 AC 83 ms
16,220 KB
testcase_04 AC 80 ms
16,220 KB
testcase_05 AC 86 ms
16,220 KB
testcase_06 AC 80 ms
16,220 KB
testcase_07 AC 80 ms
16,220 KB
testcase_08 AC 82 ms
16,220 KB
testcase_09 AC 78 ms
16,220 KB
testcase_10 AC 81 ms
16,220 KB
testcase_11 AC 82 ms
16,220 KB
testcase_12 AC 88 ms
16,340 KB
testcase_13 AC 90 ms
16,336 KB
testcase_14 AC 95 ms
16,336 KB
testcase_15 AC 85 ms
16,336 KB
testcase_16 AC 83 ms
16,320 KB
testcase_17 AC 82 ms
16,220 KB
testcase_18 AC 80 ms
16,220 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #

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
0