結果

問題 No.628 Tagの勢い
ユーザー iad_2889
提出日時 2019-05-16 12:11:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-17 05:28:29
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

class Photo:
    tag = {}
    def __init__(self,no,M,score,tag):
        self.no = no
        self.score = score
        for t in tag:
            Photo.tag.setdefault(t,0)
            Photo.tag[t]+=score

    @classmethod
    def show_tag_rank(cls):
        itms = sorted(cls.tag.items(),key=lambda x:x[0])
        itms.sort(key=lambda x:x[1],reverse=True)
        for cnt,item in enumerate(itms):
            tag,score = item
            print(tag,score)
            if cnt == 9:
                break



N = int(input())
photos = [Photo(int(input()),*map(int,input().split()),input().split()) for i in range(N)]
Photo.show_tag_rank()
0