結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー qibqib
提出日時 2022-11-03 23:18:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 817 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 80,468 KB
最終ジャッジ日時 2023-09-25 06:23:29
合計ジャッジ時間 5,212 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,464 KB
testcase_01 AC 70 ms
71,392 KB
testcase_02 AC 70 ms
71,500 KB
testcase_03 AC 136 ms
78,112 KB
testcase_04 AC 107 ms
77,908 KB
testcase_05 AC 143 ms
79,388 KB
testcase_06 AC 140 ms
79,552 KB
testcase_07 AC 122 ms
78,380 KB
testcase_08 AC 138 ms
79,232 KB
testcase_09 AC 142 ms
80,216 KB
testcase_10 AC 106 ms
77,112 KB
testcase_11 AC 110 ms
78,028 KB
testcase_12 AC 125 ms
78,664 KB
testcase_13 AC 138 ms
79,668 KB
testcase_14 AC 143 ms
80,172 KB
testcase_15 AC 109 ms
78,100 KB
testcase_16 AC 92 ms
76,140 KB
testcase_17 AC 108 ms
77,896 KB
testcase_18 AC 88 ms
76,172 KB
testcase_19 AC 139 ms
80,468 KB
testcase_20 AC 139 ms
80,100 KB
testcase_21 AC 108 ms
78,052 KB
testcase_22 AC 107 ms
77,976 KB
testcase_23 AC 109 ms
77,912 KB
testcase_24 AC 139 ms
79,576 KB
testcase_25 AC 144 ms
80,348 KB
testcase_26 AC 118 ms
78,916 KB
testcase_27 AC 116 ms
78,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
l = list(map(int, input().split()))

t = int(input())
queries = []
cnt = [0 for _ in range(n)]
idx = {}
names = []
for i in range(t):
  name, prob = input().split()
  prob = ord(prob) - ord("A")
  if idx.get(name, None) is None:
    idx[name] = len(idx)
    names.append(name)
  cnt[prob] += 1
  s = 50 * l[prob] + (50 * l[prob]) * 5 // (4 + cnt[prob])
  queries.append((idx[name], prob, s))

last = [t + 1 for _ in range(len(idx))]
score = [[0 for _ in range(n + 1)] for _ in range(len(idx))]
for k in range(t):
  i, j, s = queries[k]
  score[i][j] += s
  last[i] = k

for i in range(len(idx)):
  score[i][n] = sum(score[i])

ranking = [i for i in range(len(idx))]
ranking.sort(key=lambda x: (- score[x][-1], last[x]))
for i in range(len(idx)):
  x = ranking[i]
  print(f"{i + 1} {names[x]} " + " ".join(map(str, score[x])))
0