結果

問題 No.628 Tagの勢い
ユーザー 学ぶマン
提出日時 2025-03-22 11:50:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2025-03-22 11:50:57
合計ジャッジ時間 2,812 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
dd = defaultdict(int)

for _ in range(N):
    n = int(input())
    m, score = map(int, input().split())
    words = list(input().split())
    for word in words:
        dd[word] += score

ans = sorted(dd.items())
ans.sort(key=lambda x: x[0])
ans.sort(key=lambda x: x[1], reverse=True)

for i in range(10):
    if i == len(ans):
        break
    print(*ans[i])
0