結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2023-10-27 09:50:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 94 ms / 2,000 ms |
コード長 | 361 bytes |
コンパイル時間 | 352 ms |
コンパイル使用メモリ | 82,596 KB |
実行使用メモリ | 77,220 KB |
最終ジャッジ日時 | 2024-09-25 12:56:58 |
合計ジャッジ時間 | 2,274 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
from collections import defaultdict n = int(input()) dt = {} A = [] for i in range(n): _ = input() _, s = map(int, input().split()) T = input().split() for t in T: if not t in dt: dt[t] = len(dt) A.append([0, t]) A[dt[t]][0] += s A.sort(key=lambda x: (-x[0], x[1])) for a, b in A[:10]: print(b, a)