結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー ryoo14ryoo14
提出日時 2016-11-28 23:38:47
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 1,400 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 74,240 KB
最終ジャッジ日時 2024-05-05 14:44:42
合計ジャッジ時間 10,390 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 80 ms
12,160 KB
testcase_02 AC 74 ms
12,160 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 WA -
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

problem_num = gets.to_i
star_table = gets.split.map(&:to_i)

problem_table = {}
problem_num.times do |n|
  problem_table[(n+65).chr] = 1
end

score = Hash.new { |a, b| a[b] = Hash.new { |c, d| c[d] = 0 } }
score_total = Hash.new { |c, d| c[d] = 0 }
submit_order = {}

submit_num = gets.to_i
submit_num.times do |n|
  tmp = gets.split
  score[tmp[0]][tmp[1]] = (star_table[tmp[1].ord - 65] * 50 + 50 * star_table[tmp[1].ord - 65] / (0.8 + 0.2 * problem_table[tmp[1]])).floor
  score_total[tmp[0]] = score_total[tmp[0]] + score[tmp[0]][tmp[1]]
  submit_order[tmp[0]] = n
  problem_table[tmp[1]] += 1
end

score_total_desc = score_total.sort { |(k1, v1), (k2, v2)| v2 <=> v1 }

score_order = {}
num = 1
score_total_desc.each_with_index do |(k1, v1), n1|
  tmp = score_total_desc.select { |k2, v2| v1 = v2 }
  if tmp.nil? then
    score_order[k1] = num
    num += 1
  else
    t = num
    tmp.each do |k3, v3|
      if submit_order[k1] > submit_order[k3] then
        t += 1
      end
    end
    if t == num then
      score_order[k1] = num
      num += 1
    else
      score_order[k1] = t
    end
  end
end

score_order_asc = score_order.sort { |(k1, v1), (k2, v2)| v1 <=> v2 }

ans = []
score_order_asc.each do |k, v|
  line = v.to_s + " " + k + " "
  problem_table.each_key do |t|
    line += score[k][t].to_s + " "
  end
  line += score_total[k].to_s
  ans << line
end

ans.each do |a|
  puts a
end
0