結果

問題 No.628 Tagの勢い
ユーザー dango
提出日時 2023-06-06 20:42:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 616 ms
コンパイル使用メモリ 82,584 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-12-29 08:46:12
合計ジャッジ時間 2,600 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
score = defaultdict(int)
for _ in range(int(input())):
  _ = int(input())
  _, S = map(int, input().split())
  for tag in input().split():
    score[tag] += S
scorelist = [elm for elm in score.items()]
scorelist.sort(key=lambda elm: (-elm[1], elm[0]))
for idx, (tagname, num) in enumerate(scorelist):
  if idx >= 10:
    break
  print(tagname, num)
0