結果
問題 |
No.628 Tagの勢い
|
ユーザー |
|
提出日時 | 2018-04-12 02:45:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 1,119 ms |
コンパイル使用メモリ | 94,488 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 22:42:19 |
合計ジャッジ時間 | 1,778 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 9 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> #include<utility> #include<vector> #include<map> using namespace std; int n; map<string,int>M; main() { cin>>n; for(int i=0;i<n;i++) { int m,s;cin>>m>>m>>s; string t; for(int j=0;j<m;j++) { cin>>t; M[t]+=s; } } vector<pair<int,string> >P; for(map<string,int>::iterator it=M.begin();it!=M.end();it++) { P.push_back(make_pair(-(*it).second,(*it).first)); } sort(P.begin(),P.end()); for(int i=0;i<(P.size()<10?P.size():10);i++)cout<<P[i].second<<" "<<-P[i].first<<endl; }