結果
問題 | No.628 Tagの勢い |
ユーザー |
![]() |
提出日時 | 2018-01-05 21:41:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 1,553 ms |
コンパイル使用メモリ | 176,028 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 22:08:03 |
合計ジャッジ時間 | 2,240 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; signed main(){ Int n; cin>>n; map<string, Int> mp; for(Int i=0;i<n;i++){ Int no,m,s; cin>>no>>m>>s; string t; for(Int j=0;j<m;j++){ cin>>t; mp[t]+=s; } } using P = pair<Int, string>; priority_queue<P,vector<P>,greater<P> > pq; for(auto p:mp) pq.emplace(-p.second,p.first); Int x=10; while(!pq.empty()&&x--){ P p=pq.top();pq.pop(); cout<<p.second<<" "<<-p.first<<endl; } return 0; }