結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
![]() |
提出日時 | 2016-11-20 19:58:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 178 ms / 2,000 ms |
コード長 | 1,071 bytes |
コンパイル時間 | 791 ms |
コンパイル使用メモリ | 81,848 KB |
実行使用メモリ | 80,984 KB |
最終ジャッジ日時 | 2024-11-27 09:02:39 |
合計ジャッジ時間 | 5,848 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#!/usr/bin/env pypy3 import collections import heapq def sub_score(level, ac_pos): return 50 * level + 500 * level // (8 + 2 * ac_pos) def alpha2int(c): return ord(c) - ord("A") def main(): n = int(input()) ls = [int(l) for l in input().split()] t = int(input()) pq = [] ac_pos = [1 for _ in range(n)] total_score = collections.defaultdict(int) each_score = collections.defaultdict(lambda: [0 for _ in range(n)]) for i in range(t): name, p = input().split() p_id = alpha2int(p) s = sub_score(ls[p_id], ac_pos[p_id]) ac_pos[p_id] += 1 each_score[name][p_id] += s total_score[name] += s heapq.heappush(pq, (-total_score[name], i, name)) processed_names = set() j = 0 while pq: total, _, name = heapq.heappop(pq) if name not in processed_names: processed_names.add(name) j += 1 mes = " ".join(str(x) for x in each_score[name]) print(j, name, mes, -total) if __name__ == '__main__': main()