結果

問題 No.628 Tagの勢い
ユーザー kichirb3kichirb3
提出日時 2018-03-02 11:49:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 874 bytes
コンパイル時間 1,357 ms
コンパイル使用メモリ 100,892 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 20:09:33
合計ジャッジ時間 2,024 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 4 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// No.628 Tagの勢い
// https://yukicoder.me/problems/no/628
//
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <unordered_map>
using namespace std;


int main() {
    int N;
    cin >> N;

    unordered_map<string, int> scores;
    for (auto i = 0; i < N; ++i) {
        int dummy;
        cin >> dummy;
        int M, S;
        cin >> M >> S;
        for (auto j = 0; j < M; j++) {
            string t;
            cin >> t;
            scores[t] += S;
        }
    }

    vector<pair<int, string>> res;
    for (auto s: scores) {
        res.push_back(make_pair(-s.second, s.first));
    }
    sort(res.begin(), res.end());

    int count = 0;
    for (auto r: res) {
        cout << r.second << " " << -r.first << endl;
        ++count;
        if (count >= 10)
            break;
    }
}
0