結果

問題 No.628 Tagの勢い
ユーザー clearbook
提出日時 2020-01-04 17:20:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-22 21:04:04
合計ジャッジ時間 1,478 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter

N = int(input())

ans = dict()
for i in range(N):
    num = int(input())
    M, score = map(int, input().split())
    word = list(map(str, input().split()))
    
    for j in range(M):
        if word[j] in ans:
            ans[word[j]] += score
        else:
            ans[word[j]] = score
            
ans = sorted(ans.items(), key=itemgetter(0))
ans = sorted(ans, reverse=True, key=itemgetter(1))

for i in range(min(len(ans), 10)):
    print(ans[i][0], ans[i][1])
0