結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー | siman |
提出日時 | 2023-01-02 09:50:05 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 143 ms / 2,000 ms |
コード長 | 876 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 11,320 KB |
実行使用メモリ | 18,496 KB |
最終ジャッジ日時 | 2023-08-17 23:22:55 |
合計ジャッジ時間 | 4,355 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
15,160 KB |
testcase_01 | AC | 82 ms
15,168 KB |
testcase_02 | AC | 80 ms
15,296 KB |
testcase_03 | AC | 91 ms
15,368 KB |
testcase_04 | AC | 88 ms
15,312 KB |
testcase_05 | AC | 107 ms
17,132 KB |
testcase_06 | AC | 130 ms
17,300 KB |
testcase_07 | AC | 103 ms
15,648 KB |
testcase_08 | AC | 105 ms
16,572 KB |
testcase_09 | AC | 123 ms
17,444 KB |
testcase_10 | AC | 87 ms
15,548 KB |
testcase_11 | AC | 93 ms
15,252 KB |
testcase_12 | AC | 96 ms
15,720 KB |
testcase_13 | AC | 118 ms
17,332 KB |
testcase_14 | AC | 123 ms
17,548 KB |
testcase_15 | AC | 92 ms
15,492 KB |
testcase_16 | AC | 89 ms
15,740 KB |
testcase_17 | AC | 92 ms
15,360 KB |
testcase_18 | AC | 83 ms
15,300 KB |
testcase_19 | AC | 143 ms
18,496 KB |
testcase_20 | AC | 129 ms
17,492 KB |
testcase_21 | AC | 93 ms
15,604 KB |
testcase_22 | AC | 90 ms
15,360 KB |
testcase_23 | AC | 98 ms
15,724 KB |
testcase_24 | AC | 123 ms
17,172 KB |
testcase_25 | AC | 138 ms
18,216 KB |
testcase_26 | AC | 105 ms
15,948 KB |
testcase_27 | AC | 103 ms
15,892 KB |
コンパイルメッセージ
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] + 50 * L[type] / (0.8 + 0.2 * counter[type])).to_i 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.0001 * penalty[row.first] }.reverse_each.with_index(1) do |row, rank| puts "#{rank} #{row.join(' ')}" end