結果
問題 |
No.628 Tagの勢い
|
ユーザー |
|
提出日時 | 2020-06-07 11:51:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 3,139 ms |
コンパイル使用メモリ | 207,564 KB |
最終ジャッジ日時 | 2025-01-10 23:43:06 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; struct pr{ string tag; int p; bool operator<(const pr&oth)const{ if(p==oth.p)return tag>oth.tag; return p<oth.p; } }; int main(){ int n; cin>>n; unordered_map<string,int>mp; for(int i=0;i<n;++i){ int no,m,s; cin>>no>>m>>s; for(int j=0;j<m;++j){ string tag; cin>>tag; mp[tag]+=s; } } priority_queue<pr>q; for(auto&&i:mp)q.push({i.first,i.second}); int i=0; while(i<10&&q.size()){ cout<<q.top().tag<<" "s<<q.top().p<<"\n"s; q.pop(); ++i; } }