結果

問題 No.628 Tagの勢い
コンテスト
ユーザー dango
提出日時 2023-06-06 20:42:12
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 384 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 249 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 74,624 KB
最終ジャッジ日時 2026-06-03 04:17:28
合計ジャッジ時間 1,936 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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