結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-04-09 16:57:04 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 826 bytes | 
| コンパイル時間 | 1,436 ms | 
| コンパイル使用メモリ | 96,712 KB | 
| 最終ジャッジ日時 | 2025-01-09 15:30:01 | 
| ジャッジサーバーID (参考情報) | judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
void solve() {
    int n;
    std::cin >> n;
    std::map<std::string, int> score;
    while (n--) {
        int m, x;
        std::cin >> m >> m >> x;
        while (m--) {
            std::string s;
            std::cin >> s;
            if (!score.count(s)) score[s] = 0;
            score[s] += x;
        }
    }
    std::vector<std::pair<int, std::string>> ps;
    for (auto& p : score) {
        ps.emplace_back(-p.second, p.first);
    }
    std::sort(ps.begin(), ps.end());
    if (ps.size() > 10) ps.resize(10);
    for (auto p : ps) {
        std::cout << p.second << " " << -p.first << std::endl;
    }
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    solve();
    return 0;
}
            
            
            
        