結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー suppy193suppy193
提出日時 2017-02-10 10:34:14
言語 Ruby
(3.3.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 11,364 KB
実行使用メモリ 18,808 KB
最終ジャッジ日時 2023-08-27 05:17:57
合計ジャッジ時間 4,855 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,084 KB
testcase_01 AC 83 ms
15,340 KB
testcase_02 AC 81 ms
15,284 KB
testcase_03 AC 103 ms
15,652 KB
testcase_04 AC 100 ms
15,572 KB
testcase_05 AC 122 ms
18,808 KB
testcase_06 AC 146 ms
16,132 KB
testcase_07 AC 118 ms
15,672 KB
testcase_08 AC 119 ms
15,876 KB
testcase_09 AC 139 ms
16,752 KB
testcase_10 AC 95 ms
15,232 KB
testcase_11 AC 105 ms
15,572 KB
testcase_12 AC 105 ms
15,732 KB
testcase_13 AC 132 ms
16,512 KB
testcase_14 AC 144 ms
17,892 KB
testcase_15 AC 111 ms
15,720 KB
testcase_16 AC 99 ms
15,356 KB
testcase_17 AC 106 ms
15,596 KB
testcase_18 AC 91 ms
15,448 KB
testcase_19 AC 171 ms
16,760 KB
testcase_20 AC 149 ms
17,208 KB
testcase_21 AC 106 ms
15,488 KB
testcase_22 AC 102 ms
15,344 KB
testcase_23 AC 120 ms
16,040 KB
testcase_24 AC 149 ms
15,720 KB
testcase_25 AC 165 ms
16,080 KB
testcase_26 AC 129 ms
15,652 KB
testcase_27 AC 126 ms
15,572 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.strip.to_i
level = gets.strip.split(' ').map(&:to_i)
t = gets.strip.to_i
memo = Hash.new()
ac = Hash.new(0)
scores = Hash.new(0)
ranking = Hash.new([])
t.times do
	name, problem = gets.strip.split(' ')
	ac[problem] += 1

	score = (50 * level[problem[0].ord - 'A'.ord] + 50 * level[problem[0].ord - 'A'.ord] / (0.8 + 0.2 * ac[problem])).floor
	# p score
	ranking[scores[name]].delete(name)
	scores[name] += score
	ranking[scores[name]] += [name]
	unless memo.key?(name)
		memo[name] = Hash.new(0)
	end
	memo[name][problem] = score
end
ranking = ranking.sort{|a, b| b[0] <=> a[0]}

i = 1
ranking.each do |arr|
	arr[1].each do |name|
		print "#{i} #{name} " 
		(0...n).each do |j|
			if memo[name].key?(('A'.ord + j).chr)
				print "#{memo[name][('A'.ord + j).chr]} "
			else
				print "0 "
			end
			
		end
		print "#{scores[name]}\n"
		i += 1
	end	
end
0