結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
![]() |
提出日時 | 2023-01-02 09:27:53 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 881 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 14,848 KB |
最終ジャッジ日時 | 2024-11-27 00:38:19 |
合計ジャッジ時間 | 4,080 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | WA * 25 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i L = gets.split.map(&:to_i) T = gets.to_i def calc_score(type, counter) counter[type] += 1 (50 * L[type] + Rational(50 * L[type], 0.8 + 0.2 * counter[type])).floor end data = Hash.new { |h, k| h[k] = Hash.new(0) } counter = Hash.new(0) fast_bonus = Hash.new(0) penalty = Hash.new(0) scores = Hash.new(0) T.times do |t| name, p_type = gets.chomp.split p_type = p_type.ord - 'A'.ord score = calc_score(p_type, counter) scores[name] += score fast_bonus[scores[name]] += 1 penalty[name] = fast_bonus[scores[name]] data[name][p_type] = score end ranking = [] data.each do |name, d| row = [] row << name sum = 0 N.times do |i| sum += d[i] row << d[i] end row << sum ranking << row end ranking.sort_by { |row| row.last - 0.01 * penalty[row.first] }.reverse_each.with_index(1) do |row, rank| puts "#{rank} #{row.join(' ')}" end