結果
問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
ユーザー |
![]() |
提出日時 | 2020-02-25 14:17:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 1,274 bytes |
コンパイル時間 | 85 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-10-13 12:14:04 |
合計ジャッジ時間 | 3,112 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#!/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)