結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー はむ吉🐹はむ吉🐹
提出日時 2016-11-20 19:58:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 1,071 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 81,808 KB
最終ジャッジ日時 2023-08-18 05:52:05
合計ジャッジ時間 8,211 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
71,796 KB
testcase_01 AC 98 ms
71,644 KB
testcase_02 AC 103 ms
71,768 KB
testcase_03 AC 187 ms
79,036 KB
testcase_04 AC 171 ms
78,880 KB
testcase_05 AC 234 ms
80,180 KB
testcase_06 AC 233 ms
81,808 KB
testcase_07 AC 221 ms
81,152 KB
testcase_08 AC 227 ms
80,440 KB
testcase_09 AC 234 ms
81,196 KB
testcase_10 AC 165 ms
78,688 KB
testcase_11 AC 186 ms
78,992 KB
testcase_12 AC 202 ms
79,340 KB
testcase_13 AC 246 ms
81,348 KB
testcase_14 AC 254 ms
81,724 KB
testcase_15 AC 188 ms
79,268 KB
testcase_16 AC 151 ms
78,084 KB
testcase_17 AC 186 ms
79,044 KB
testcase_18 AC 141 ms
77,640 KB
testcase_19 AC 234 ms
81,532 KB
testcase_20 AC 240 ms
81,792 KB
testcase_21 AC 194 ms
79,280 KB
testcase_22 AC 196 ms
79,224 KB
testcase_23 AC 215 ms
80,580 KB
testcase_24 AC 251 ms
81,560 KB
testcase_25 AC 259 ms
81,596 KB
testcase_26 AC 228 ms
80,768 KB
testcase_27 AC 207 ms
80,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/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()
0