結果

問題 No.628 Tagの勢い
ユーザー kohei2019kohei2019
提出日時 2022-02-16 22:36:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 86,664 KB
実行使用メモリ 78,480 KB
最終ジャッジ日時 2023-09-11 17:16:27
合計ジャッジ時間 3,381 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,768 KB
testcase_01 AC 93 ms
71,692 KB
testcase_02 AC 93 ms
71,552 KB
testcase_03 AC 96 ms
71,764 KB
testcase_04 AC 95 ms
71,784 KB
testcase_05 AC 93 ms
71,756 KB
testcase_06 AC 94 ms
71,752 KB
testcase_07 AC 94 ms
71,504 KB
testcase_08 AC 93 ms
71,336 KB
testcase_09 AC 93 ms
71,308 KB
testcase_10 AC 97 ms
71,576 KB
testcase_11 AC 95 ms
71,684 KB
testcase_12 AC 133 ms
78,256 KB
testcase_13 AC 129 ms
78,032 KB
testcase_14 AC 129 ms
78,480 KB
testcase_15 AC 129 ms
78,288 KB
testcase_16 AC 139 ms
78,392 KB
testcase_17 AC 93 ms
71,608 KB
testcase_18 AC 94 ms
71,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N = int(input())
d = collections.defaultdict(lambda:0)

for i in range(N):
    input()
    a,b = map(int,input().split())
    tag = input().split()
    for i in range(a):
        d[tag[i]] += b
    
tp = [(val,key) for key,val in d.items()]
tp.sort(key=lambda x:x[1])
tp.sort(key=lambda x:-x[0])

for v,k in tp[:10]:
    print(k,v)
0