結果
問題 |
No.628 Tagの勢い
|
ユーザー |
![]() |
提出日時 | 2018-08-20 16:52:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 801 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-07 22:54:19 |
合計ジャッジ時間 | 1,369 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
tag_management = {} photo_num = int(input()) for i in range(photo_num): input() tmp = input().split() tag_num = int(tmp[0]) point = int(tmp[1]) tags = input().split() for j in range(tag_num): if tags[j] not in tag_management: tag_management[tags[j]] = point else: tag_management[tags[j]] += point #print(tag_management) word_sorted_tag = sorted(tag_management.items(),key=lambda x: x[0]) sorted_tag = sorted(word_sorted_tag, key=lambda x: -x[1]) count = 0 for i in range(len(sorted_tag)): count += 1 k,v = sorted_tag[i] print(str(k) + " " + str(v)) if count == 10: break """ for k, v in sorted(tag_management.items(), key=lambda x: x[1]): print(str(k) + " " + str(v)) """