結果

問題 No.628 Tagの勢い
ユーザー るさ
提出日時 2018-05-30 18:40:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-10-07 22:50:01
合計ジャッジ時間 1,693 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

data=[]
for i in range(int(input())):
    input()
    a,sc=list(map(int,input().split()))
    tag=input().split()
    data.append([sc,tag])
score={}
for i in range(len(data)):
    for j in data[i][1]:
        if j in score:
            score[j]+=data[i][0]
        else:
            score[j]=data[i][0]
lsc=[]
for i in score:
    lsc.append([i,score[i]])
lsc.sort(key=lambda x:(-x[1],x[0]))
for i in range(10):
    try:
        print(lsc[i][0]+" "+str(lsc[i][1]))
    except:
        break
0