結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー ヒッキープログラミングするスレ GitHub ガチ
提出日時 2016-11-18 23:40:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 1,331 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-11-26 08:44:07
合計ジャッジ時間 2,528 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

def calcscore(lv, tm):
    from math import floor
    return int(floor(50 * lv + 50.0 * lv / (0.8 + 0.2 * tm)))

n = int(input())
level = {}
acninzu = {}
for i, lv in enumerate(map(int, input().split())):
    problem = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[i:i+1]
    level[problem] = lv
    acninzu[problem] = 0

kakujinscore = {}

t = int(input())
for i in range(t):
    name, problem = input().split()
    acninzu[problem] += 1
    thisscore = calcscore(level[problem], acninzu[problem])
    if name in kakujinscore:
        scores, _ = kakujinscore[name]
        scores[problem] = thisscore
        kakujinscore[name] = scores, i
    else:
        scores = {}
        scores[problem] = thisscore
        kakujinscore[name] = scores, i

def sortfunc(name):
    scores, time = kakujinscore[name]
    totalscore = sum(scores.values())
    return totalscore * t + (t - time - 1)

ranking = sorted(kakujinscore, key=sortfunc, reverse=True)

for i, name in enumerate(ranking):
    scores, _ = kakujinscore[name]
    scorelist = []
    for j, problem in enumerate('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
        if j >= n:
            break
        if problem in scores:
            scorelist.append(scores[problem])
        else:
            scorelist.append(0)   
    totalscore = sum(scores.values())
    print(i + 1, name, *scorelist, totalscore)

0