結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー |  kagasan | 
| 提出日時 | 2019-08-26 20:36:03 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 783 bytes | 
| コンパイル時間 | 2,110 ms | 
| コンパイル使用メモリ | 185,380 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-08 02:28:43 | 
| 合計ジャッジ時間 | 3,023 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;};
typedef pair<ll, string>P;
int main(){
    ll N;
    cin >> N;
    map<string, ll>cnt;
    for(ll i = 0; i < N; i++){
        ll no;
        cin >> no;
        ll M, S;
        cin >> M >> S;
        for(ll j = 0; j < M; j++){
            string tag;
            cin >> tag;
            cnt[tag]+=S;
        }
    }
    vector<P>v;
    for(map<string, ll>::iterator it = cnt.begin(); it != cnt.end(); it++){
        v.push_back(P(-(*it).second, (*it).first));
    }
    sort(v.begin(), v.end());
    for(ll i = 0; i < v.size() && i < 10; i++){
        cout << v[i].second << " " << -v[i].first << endl;
    }
    return 0;
}
            
            
            
        