結果
問題 |
No.628 Tagの勢い
|
ユーザー |
![]() |
提出日時 | 2018-07-29 11:10:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 1,640 ms |
コンパイル使用メモリ | 177,128 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 22:52:34 |
合計ジャッジ時間 | 2,339 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int n,no,k,U; cin >> n; map<string,int> mp; string tag; for(int i=0;i<n;++i){ cin >> no >> k >> U; for(int j=0;j<k;++j){ cin >> tag; mp[tag]+=U; } } vector<pair<int,string>> res; for(auto p:mp){ res.emplace_back(-p.second, p.first); } sort(res.begin(),res.end()); k=min(10,(int)res.size()); for(int i=0;i<k;++i){ cout << res[i].second << " " << -res[i].first << endl; } return 0; }