結果

問題 No.628 Tagの勢い
ユーザー RyutoRyuto
提出日時 2018-01-31 15:42:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,952 KB
最終ジャッジ日時 2024-04-16 20:05:51
合計ジャッジ時間 1,776 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,352 KB
testcase_01 AC 40 ms
52,480 KB
testcase_02 AC 40 ms
52,352 KB
testcase_03 AC 44 ms
52,608 KB
testcase_04 AC 37 ms
52,608 KB
testcase_05 AC 38 ms
52,608 KB
testcase_06 AC 37 ms
52,480 KB
testcase_07 AC 37 ms
52,608 KB
testcase_08 AC 40 ms
52,864 KB
testcase_09 AC 37 ms
52,480 KB
testcase_10 AC 38 ms
52,992 KB
testcase_11 AC 39 ms
53,376 KB
testcase_12 AC 78 ms
76,672 KB
testcase_13 AC 79 ms
76,952 KB
testcase_14 AC 76 ms
76,780 KB
testcase_15 AC 85 ms
76,924 KB
testcase_16 AC 68 ms
72,192 KB
testcase_17 AC 36 ms
52,480 KB
testcase_18 AC 38 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python

from operator import itemgetter

n = int(input())
tags = {}
for i in range(n):
    no = input()
    score = [int(x) for x in input().split()]
    tagname = input().split()
    for tag in tagname:
        if tag in tags:
            tags[tag] += score[1]
        else:
            tags[tag] = score[1]

tags = sorted(tags.items(), key=itemgetter(0))
tags = sorted(tags, key=itemgetter(1), reverse=True)

for i in range(min(len(tags), 10)):
    print(' '.join([str(x) for x in tags[i]]))
0