結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー nanae
提出日時 2017-02-10 07:49:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-12-26 14:22:46
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from itertools import combinations
from math import floor
from operator import itemgetter

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    Ls = [int(i) for i in input().split()]
    rank = [0] * N
    scores = {}

    T = int(input())

    for i in range(T):
        name, p = input().split()
        p = ord(p) - ord('A')
        rank[p] += 1

        if name not in scores:
            scores[name] = [0] * (N + 1)
        
        scores[name][p] += floor(50*Ls[p] + 50*Ls[p]/(0.8+0.2*rank[p]))
        scores[name][N] = i # last submit

    # debug(scores, locals())

    output = []

    for name, score in scores.items():
        output.append([name] + score[:-1] + [sum(score[:-1])] + [score[-1]])

    # debug(output, locals())

    output.sort(key=itemgetter(N+2))
    output.sort(key=itemgetter(N+1), reverse=True)

    for i in range(len(output)):
        print(i+1, *output[i][:-1])


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