結果

問題 No.628 Tagの勢い
ユーザー donkorin_donkorin_
提出日時 2018-10-01 13:44:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,356 bytes
コンパイル時間 2,259 ms
コンパイル使用メモリ 182,160 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 20:19:08
合計ジャッジ時間 2,892 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 3 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}
bool comp(const pair<int, string>& fi, const pair<int, string>& se) {
    return fi.second > se.second;
}
int n;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    map<string, int> rank;
    rep(i, 0, n) {
        int ni, m, s;
        cin >> ni >> m >> s;
        rep(j, 0, m) {
            string label;
            cin >> label;
            rank[label]+=s;
        }
    }
    vector<pair<int, string> > a;
    for (auto x : rank) {
        a.pb(mp(-x.second, x.first));
    }
    sort(ALL(a));
    rep(i, 0, min((int)a.size(), 10)) {
        cout << a[i].second << " " << -a[i].first << endl;
    }
    return 0;
}
0