結果

問題 No.628 Tagの勢い
ユーザー Shawn stayC
提出日時 2020-07-11 14:36:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 186,000 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 01:45:31
合計ジャッジ時間 2,627 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){
	int n,a,m,p; cin>>n;
	map<string,int> mp;
	rep(i,n){
		cin>>a>>m>>p;
		rep(j,m){
			string s; cin>>s;
			mp[s]+=p;
		}
	}
	
	vector<pair<int,string>> vp;
	for(auto x:mp) vp.emplace_back(x.second*-1,x.first);
	sort(all(vp));
	if(mp.size()>9){
		rep(i,10) cout<<vp[i].second<<" "<<vp[i].first*-1<<endl;
	}else{
		rep(i,mp.size()) cout<<vp[i].second<<" "<<vp[i].first*-1<<endl;
	}
}
0