結果

問題 No.628 Tagの勢い
コンテスト
ユーザー SSRS
提出日時 2020-08-24 10:04:19
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
+ 949µs
コード長 605 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 812 ms
コンパイル使用メモリ 115,068 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-09-19 14:19:06
合計ジャッジ時間 2,254 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int N;
	cin >> N;
	map<string, int> mp;
	for (int i = 0; i < N; i++){
		int No;
		cin >> No;
		int M, S;
		cin >> M >> S;
		for (int j = 0; j < M; j++){
			string Tag;
			cin >> Tag;
			mp[Tag] += S;
		}
	}
	vector<pair<int, string>> R;
	for (auto P : mp){
		R.push_back(make_pair(- P.second, P.first));
	}
	sort(R.begin(), R.end());
	int cnt = min((int) R.size(), 10);
	for (int i = 0; i < cnt; i++){
		cout << R[i].second << ' ' << - R[i].first << endl;
	}
}
0