結果

問題 No.628 Tagの勢い
ユーザー kotatsugamekotatsugame
提出日時 2018-04-12 02:45:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 1,280 ms
コンパイル使用メモリ 94,108 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 20:11:58
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 5 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~

ソースコード

diff #

#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;
}
0