結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー yuruhiyayuruhiya
提出日時 2020-07-26 14:21:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 573 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 11,436 KB
実行使用メモリ 19,092 KB
最終ジャッジ日時 2023-09-11 00:18:48
合計ジャッジ時間 5,303 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,044 KB
testcase_01 AC 82 ms
15,160 KB
testcase_02 AC 82 ms
15,148 KB
testcase_03 AC 105 ms
15,548 KB
testcase_04 AC 102 ms
15,256 KB
testcase_05 AC 128 ms
16,520 KB
testcase_06 AC 148 ms
17,652 KB
testcase_07 AC 119 ms
15,904 KB
testcase_08 AC 126 ms
16,468 KB
testcase_09 AC 143 ms
17,196 KB
testcase_10 AC 91 ms
15,364 KB
testcase_11 AC 98 ms
15,508 KB
testcase_12 AC 102 ms
15,868 KB
testcase_13 AC 133 ms
16,584 KB
testcase_14 AC 147 ms
16,804 KB
testcase_15 AC 103 ms
15,644 KB
testcase_16 AC 99 ms
15,592 KB
testcase_17 AC 104 ms
15,572 KB
testcase_18 AC 94 ms
15,416 KB
testcase_19 AC 169 ms
19,092 KB
testcase_20 AC 156 ms
17,648 KB
testcase_21 AC 106 ms
15,468 KB
testcase_22 AC 100 ms
15,384 KB
testcase_23 AC 107 ms
15,764 KB
testcase_24 AC 139 ms
17,396 KB
testcase_25 AC 155 ms
18,180 KB
testcase_26 AC 113 ms
16,296 KB
testcase_27 AC 114 ms
16,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
level = gets.split.map &:to_i
ac_count = [0] * n

user = Hash.new
gets.to_i.times do |i|
	name, problem = gets.split
	id = problem.ord - 'A'.ord
	ac_count[id] += 1
	score =
		50 * level[id] +
			50 * level[id] / (Rational('4/5') + Rational('1/5') * ac_count[id])
	user[name] = [[0] * n, 0] if !user.key?(name)
	user[name][0][id] = score.floor
	user[name][1] = i
end

result = user.sort_by { |name, (score, time)| [-score.sum, time] }
puts result.map.with_index(1) { |(name, (score, time)), i|
		[i, name, score, score.sum].flatten.join(' ')
     }.join("\n")
0