結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー maspymaspy
提出日時 2020-02-25 14:17:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 1,274 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-21 13:35:46
合計ジャッジ時間 2,493 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 26 ms
10,624 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 33 ms
11,008 KB
testcase_05 AC 43 ms
12,032 KB
testcase_06 AC 53 ms
12,416 KB
testcase_07 AC 41 ms
11,392 KB
testcase_08 AC 41 ms
11,648 KB
testcase_09 AC 49 ms
12,288 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
11,008 KB
testcase_12 AC 34 ms
11,264 KB
testcase_13 AC 46 ms
12,032 KB
testcase_14 AC 52 ms
12,288 KB
testcase_15 AC 34 ms
11,136 KB
testcase_16 AC 32 ms
11,008 KB
testcase_17 AC 33 ms
11,008 KB
testcase_18 AC 27 ms
10,752 KB
testcase_19 AC 56 ms
12,544 KB
testcase_20 AC 51 ms
12,288 KB
testcase_21 AC 34 ms
11,264 KB
testcase_22 AC 33 ms
11,008 KB
testcase_23 AC 36 ms
11,136 KB
testcase_24 AC 48 ms
11,904 KB
testcase_25 AC 60 ms
12,416 KB
testcase_26 AC 40 ms
11,392 KB
testcase_27 AC 39 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
N = int(readline())
L = list(map(int, readline().split()))
T = int(readline())
query = readlines()


# %%
class ContestantData():
    def __init__(self, name):
        self.name = name
        self.score = [0] * N
        self.last_update = 0
        self.total_score = 0

    def __repr__(self):
        score_str = ' '.join(map(str, self.score))
        return f'{self.name} {score_str} {self.total_score}'


# %%
Contestants = {}
AC_cnt = [0] * N
for i, line in enumerate(query, 1):
    name, prob = line.split()
    name = name.decode()
    prob = prob[0] - ord('A')
    if name in Contestants:
        contestant = Contestants[name]
    else:
        contestant = ContestantData(name)
        Contestants[name] = contestant
    AC_cnt[prob] += 1
    score = 50 * L[prob] + 500 * L[prob] // (8 + 2 * AC_cnt[prob])
    contestant.score[prob] = score
    contestant.total_score += score
    contestant.last_update = i


# %%
def sort_key(contestant):
    return contestant.total_score * 100000 - contestant.last_update


for i, x in enumerate(sorted(Contestants.values(), key=sort_key, reverse=True), 1):
    print(i, x)
0