結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-05-16 16:46:45 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 695 bytes | 
| コンパイル時間 | 2,501 ms | 
| コンパイル使用メモリ | 211,960 KB | 
| 最終ジャッジ日時 | 2025-01-21 13:13:34 | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
map <string, int> cnt;
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, no, m, s;
    string S;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> no;
        cin >> m >> s;
        for (int j = 0; j < m; j++)
        {
            cin >> S;
            cnt[S] += s;
        }
    }
    vector <pair<int, string>> v;
    for (auto it : cnt)
    {
        v.push_back(make_pair(-it.second, it.first));
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++)
    {
        if (i == 10) break;
        cout << v[i].second << ' ' << -v[i].first << '\n';
    }
    return 0;
}
            
            
            
        