結果

問題 No.628 Tagの勢い
ユーザー mmn15277198mmn15277198
提出日時 2021-03-25 21:45:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 2,632 bytes
コンパイル時間 1,346 ms
コンパイル使用メモリ 111,200 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-18 04:25:56
合計ジャッジ時間 2,411 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <stdio.h>
#include <math.h>
#include <iomanip>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;

#define rep(i,n) for(int i = 0; i < (n); i++)
#define pb push_back 
#define eb emplace_back 
#define fi first
#define se second
#define all(x) x.begin() , x.end()
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>

const static int INF = 1001001001;
const static ll LINF = 1001001001001001001LL;
const static lld PI = 3.1415926535897932384626L;
const static int MOD = 1000000009;
//const static int MOD = 998244353;

template < typename T > T gcd (T a , T b) { if (a < b) swap(a , b); if (a % b == 0) return b; else return gcd (b , a % b); }
template < typename T > T lcm (T a , T b) { return (a / gcd (a , b) * b); }
template < typename T > bool chmin (T &a , T b) { if (a > b) { a = b; return true; } else { return false; } }
template < typename T > bool chmax (T &a , T b) { if (a < b) { a = b; return true; } else { return false; } }
int keta (ll x) { int ret = 0; while(x) { ret++; x /= 10; } return ret; }
inline int in () { int x; scanf("%d" , &x); return x; }
inline ll lin () { ll x; scanf("%lld" , &x); return x; }
inline string sin () { string s; cin >> s; return s; }

void io_setup () {
    cout << fixed << setprecision(15);
    //cin.tie(0);
    //ios::sync_with_stdio(false);
}

bool is_prime (ll x) {
    if (x == 2 || x == 3 || x == 5 || x == 7) {
        return true;
    }
    for (ll i = 3; i * i <= x; i++) {
        if (x % i == 0) {
            return false;
        }
    }
    return true;
}

//vb prime_table(2020202 , true);
/*
void prime () {
    prime_table[0] = false;
    prime_table[1] = false;
    for (int i = 2; i < 2020202; i++) {
        for(int j = i + i; j < 2020202; j += i) {
            prime_table[j] = false;
        }
    }
}
*/

//memo
////v.erase(unique(v.begin(), v.end()), v.end());
map<string , int> mp;
vector<pair<int , string>> p;
void solve_1() {
    int n = in();
    int loop = in();
    int point = in();
    rep(i,loop) {
        string s = sin();
        mp[s] -= point;
    }
    return;
}

void solve_2() {
    for (auto i : mp) {
        p.eb(i.second , i.first);
    }
    sort(all(p));
}

void solve_3() {
    int loop = min(int(10) , int(p.size()));
    rep(i,loop) {
        cout << p[i].second << " " << p[i].first * -1 << endl;
    }
}

int main () {
    io_setup();
    //prime();
    int t = in();
    rep(i,t) solve_1();
    solve_2();
    solve_3();
    return 0;
}


0