結果
| 問題 | No.628 Tagの勢い | 
| コンテスト | |
| ユーザー |  yukileo9 | 
| 提出日時 | 2021-07-11 17:31:50 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 4 ms / 2,000 ms | 
| コード長 | 1,075 bytes | 
| コンパイル時間 | 2,256 ms | 
| コンパイル使用メモリ | 189,784 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-02 03:09:07 | 
| 合計ジャッジ時間 | 3,250 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
void tag_628(void) {
    int n;
    cin >> n;
    map<string, int> tag;
    int no, m, s;
    string tags;
    for (int i = 0; i < n; i++) {
        cin >> no;
        cin >> m >> s;
        for (int j = 0; j < m; j++) {
            cin >> tags;
            tag[tags] += s;
        }
    }
    map<string, int>::iterator tag_ptr;
    map<int, vector<string>> ans;
    for (tag_ptr = tag.begin(); tag_ptr != tag.end(); tag_ptr++) {
        ans[(-1) * tag_ptr->second].push_back(tag_ptr->first);
    }
    map<int, vector<string>>::iterator ansptr;
    int cnt = 0;
    for (ansptr = ans.begin(); ansptr != ans.end(); ansptr++) {
        if ((int)ansptr->second.size() > 1)
            sort(ansptr->second.begin(), ansptr->second.end());
        for (int j = 0; j < (int)ansptr->second.size(); j++) {
            cout << ansptr->second[j] << " " << ansptr->first * (-1) << endl;
            cnt++;
            if (cnt == 10) break;
        }
        if (cnt == 10) break;
    }
}
int main(void) {
    tag_628();
    return 0;
}
            
            
            
        