結果

問題 No.628 Tagの勢い
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-08 12:56:55
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 375 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 11,972 KB
実行使用メモリ 16,336 KB
最終ジャッジ日時 2023-10-26 00:49:15
合計ジャッジ時間 3,364 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
16,220 KB
testcase_01 WA -
testcase_02 AC 89 ms
16,220 KB
testcase_03 WA -
testcase_04 AC 86 ms
16,220 KB
testcase_05 AC 87 ms
16,220 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 86 ms
16,220 KB
testcase_18 AC 89 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.each do |score|
  puts "#{score[0]} #{score[1]}"
end
0