結果
| 問題 |
No.628 Tagの勢い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-13 08:28:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,781 bytes |
| コンパイル時間 | 1,757 ms |
| コンパイル使用メモリ | 121,532 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-07 22:51:36 |
| 合計ジャッジ時間 | 2,307 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 13 |
ソースコード
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>
using namespace std;
//#include<bits/stdc++.h>
int main() {
map<string, int>p;
int n, m, s;
int a;
cin >> n;
vector<pair<int, string>>w;
while (n--)
{
cin >> a >> m >> s ;
string t;
for (int i = 0; i < m; i++) {
cin >> t;
p[t] += s;
w.push_back(make_pair( p[t],t));
}
}
sort(w.begin(), w.end());
reverse(w.begin(), w.end());
map<string, bool>y;
vector<map<int, string>>b;
vector<int>k;
int e = 0;
vector<pair<int, string>>wr;
for (int i = 0; i < w.size(); i++) {
vector<pair<string, int>>q;
// cout << w[i].second<< endl;
for (int j = i; j < w.size(); j++) {
//cout <<w[i].first<<"#"<< w[j].first << endl;
if (y[w[i].second])continue;
if (w[i].first == w[j].first)q.push_back(make_pair(w[j].second,w[j].first));
else break;
y[w[j].second] = 1;
}
// cout << q.size() << endl;
sort(q.begin(), q.end());
reverse(q.begin(), q.end());
for (int j = 0; j < q.size(); j++) {
wr.push_back(make_pair(q[j].second, q[j].first));
}
if (wr.size() > 10)break;
}
for(int j=0;j<wr.size();j++)
for (int i = wr.size() - 1; i > j; i--) {
if (wr[i].first == wr[i - 1].first&&wr[i].second < wr[i - 1].second)swap(wr[i], wr[i - 1]);
}
for (int i = 0; i < wr.size(); i++) {
cout << wr[i].second << " " << wr[i].first << endl;
/*if (y[w[i].second])continue;
cout << w[i].second << " " << w[i].first << endl;
y[w[i].second] = 1;
*/
}
return 0;
}