結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2019-11-26 16:43:22 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-06 22:36:20 |
合計ジャッジ時間 | 1,708 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
n = int(input()) d = {} for i in range(n): no = int(input()) params = list(map(int,input().split())) tag = list(input().split()) for cur_tag in tag: if cur_tag in d: d[cur_tag] += params[1] else: d[cur_tag] = params[1] # 辞書dをkeyでソート sorted_d_key = sorted(d.items(), key=lambda x:x[0]) # sorted_d_keyを辞書に変換 d2 = dict(sorted_d_key) # 辞書d2をvalueで降順にソート sorted_d_value = sorted(d2.items(), reverse=True, key=lambda x:x[1]) for i in range(len(sorted_d_value)): if i == 10: break print(sorted_d_value[i][0] + ' ' + str(sorted_d_value[i][1]))