結果
| 問題 |
No.628 Tagの勢い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-08-23 17:47:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 697 bytes |
| コンパイル時間 | 2,886 ms |
| コンパイル使用メモリ | 185,816 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-07 22:55:39 |
| 合計ジャッジ時間 | 3,165 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct Pair
{
int a;
string s;
bool operator < ( const Pair &X ) const
{
return a == X.a ? s < X.s : a < X.a;
}
};
int main()
{
int i;
int j;
int N;
int M;
int S;
string Tag;
map<string, int> Mp;
vector<Pair> V;
ios::sync_with_stdio( false );
cin.tie( 0 );
cin >> N;
for( i = 0; i < N; i++ )
{
cin >> M; //cin >> No;
cin >> M;
cin >> S;
for( j = 0; j < M; j++ )
{
cin >> Tag;
Mp[ Tag ] += S;
}
}
for( auto &p : Mp )
V.emplace_back( Pair { - p.second, p.first } );
sort( V.begin(), V.end() );
i = 0;
for( auto &p: V )
{
if( i++ >= 10 ) break;
cout << p.s << " " << - p.a << endl;
}
return 0;
}