結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー ryoo14ryoo14
提出日時 2016-11-29 21:17:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 17,480 KB
最終ジャッジ日時 2023-08-27 06:42:52
合計ジャッジ時間 4,247 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
15,124 KB
testcase_01 AC 73 ms
15,220 KB
testcase_02 AC 72 ms
15,120 KB
testcase_03 AC 82 ms
15,304 KB
testcase_04 AC 82 ms
15,292 KB
testcase_05 AC 110 ms
16,304 KB
testcase_06 AC 137 ms
16,412 KB
testcase_07 AC 98 ms
15,584 KB
testcase_08 AC 109 ms
15,776 KB
testcase_09 AC 124 ms
16,768 KB
testcase_10 AC 80 ms
15,484 KB
testcase_11 AC 89 ms
15,416 KB
testcase_12 AC 92 ms
15,576 KB
testcase_13 AC 121 ms
16,292 KB
testcase_14 AC 127 ms
16,784 KB
testcase_15 AC 88 ms
15,644 KB
testcase_16 AC 86 ms
15,436 KB
testcase_17 AC 82 ms
15,436 KB
testcase_18 AC 75 ms
15,392 KB
testcase_19 AC 149 ms
17,480 KB
testcase_20 AC 127 ms
16,976 KB
testcase_21 AC 87 ms
15,472 KB
testcase_22 AC 85 ms
15,168 KB
testcase_23 AC 90 ms
15,760 KB
testcase_24 AC 122 ms
16,420 KB
testcase_25 AC 143 ms
16,760 KB
testcase_26 AC 101 ms
15,904 KB
testcase_27 AC 97 ms
16,056 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
l = gets.split.map(&:to_i)
s = Hash.new([0,1])
n.times do |i|
  s[(i+65).chr] = [l[i],1]
end

score = Hash.new{|k, v| k[v]=[0]*n}
total = Hash.new([0, 0])

t = gets.to_i
t.times do |m|
  name, pro = gets.split
  score[name][pro.ord-65] = (50 * s[pro][0] + 50 * s[pro][0] / (0.8 + 0.2 * s[pro][1])).floor
  total[name] = [total[name][0]-score[name][pro.ord-65], m]
  s[pro][1] += 1
end

total.sort_by{|k1, v1| v1}.each_with_index do |(k2, v2), i|
  ans = (i+1).to_s + " " + k2 + " "
  tt = ""
  s.each_key do |k|
    tt = tt + score[k2][k.ord-65].to_s + " "
  end
  tt = tt + (-total[k2][0]).to_s
  puts ans + tt
end
0