結果

問題 No.628 Tagの勢い
ユーザー turner18_jp
提出日時 2018-01-10 16:35:47
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-07 22:22:41
合計ジャッジ時間 1,411 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c = {}
count = 0
for i in range(n):
  no = int(input())
  m, p = map(int, input().split())
  t = list(input().split())
  for s in t:
    if s in c:
      c[s] += p
    else:
      c[s] = p

c = sorted(c.items())
c = sorted(dict(c).items(), key=lambda x: x[1], reverse=True)

for k, v in c:
  count += 1
  print(k, v)

  if count == 10 or count >= len(c):
    break
0