結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー はむ吉🐹
提出日時 2016-11-19 14:27:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 1,155 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 87,748 KB
最終ジャッジ日時 2024-11-26 21:49:30
合計ジャッジ時間 6,116 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy3

import collections
import heapq
import itertools
import string


def sub_score(level, ac_pos):
    return 50 * level + 500 * level // (8 + 2 * ac_pos)


def main():
    num_probs = int(input())
    ls = dict(zip(string.ascii_uppercase, (int(l) for l in input().split())))
    num_subs = int(input())
    ac_pos = collections.defaultdict(lambda: 1)
    total_score = collections.defaultdict(int)
    each_score = collections.defaultdict(lambda: collections.defaultdict(int))
    pq = []
    for i in range(num_subs):
        name, p = input().split()
        s = sub_score(ls[p], ac_pos[p])
        each_score[name][p] = s
        total_score[name] += s
        ac_pos[p] += 1
        heapq.heappush(pq, (-total_score[name], i, name))
    processed = set()
    j = 0
    while pq:
        total, _, name = heapq.heappop(pq)
        if name not in processed:
            j += 1
            processed.add(name)
            total = -total
            g = (each_score[name][x] for x in
                 string.ascii_uppercase[:num_probs])
            print(j, name, *itertools.chain(g, (total, )))


if __name__ == '__main__':
    main()
0