結果

問題 No.628 Tagの勢い
ユーザー cidercider
提出日時 2018-01-06 14:39:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 987 bytes
コンパイル時間 985 ms
コンパイル使用メモリ 83,368 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 20:02:48
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 5 ms
6,944 KB
testcase_13 AC 5 ms
6,944 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 5 ms
6,944 KB
testcase_16 AC 3 ms
6,944 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<fstream>
#include<utility>
#include<map>
#define rep(N) for (int i = 0; i < N; i++)
#define For(i, N) for (i = 0; i < N; i++)
#define re return 0

using namespace std;
using ll = long long int;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using pii = pair<int, int>;
using pis = pair<int, string>;

bool comp(pis A, pis B) {
	if (A.first != B.first)return A.first > B.first;
	else return A.second < B.second;
}

int main() {
	int N, No;
	vector<pis> G;
	cin >> N;
	rep(N) {
		int M, S;
		cin >> No >> M >> S;
		rep(M) {
			bool flag = true;
			string s;
			cin >> s;
			rep(G.size()) {
				if (G[i].second == s) {
					G[i].first += S;
					flag = false;
				}
			}
			if (flag) G.push_back({ S,s });
		}
	}
	sort(G.begin(), G.end(), comp);
	for (int i = 0; i < 10 && i < G.size(); ++i)
		cout << G[i].second << " " << G[i].first << endl;
	re;
}
0