結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー peroonperoon
提出日時 2019-04-24 10:51:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 1,835 bytes
コンパイル時間 2,260 ms
コンパイル使用メモリ 190,608 KB
実行使用メモリ 5,160 KB
最終ジャッジ日時 2023-08-07 07:39:49
合計ジャッジ時間 3,597 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 13 ms
4,376 KB
testcase_06 AC 15 ms
4,664 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 16 ms
4,428 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 14 ms
4,376 KB
testcase_14 AC 17 ms
4,572 KB
testcase_15 AC 4 ms
4,376 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 18 ms
5,160 KB
testcase_20 AC 17 ms
4,628 KB
testcase_21 AC 5 ms
4,376 KB
testcase_22 AC 4 ms
4,380 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 12 ms
4,424 KB
testcase_25 AC 17 ms
5,044 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 7 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl

ll N;

struct Account{
    string name;
    ll time;
    vector<ll> scores;
    ll sum = 0;

    Account(){
        name = "-1";
        time = -1;
        scores.resize(N);
    }

    void AddScore(ll i, ll score){
        scores[i] = score;
        sum += score;
    }

    string ToString(){
        stringstream ss;
        ss << name << " ";
        for(ll score : scores){
            ss << score << " ";
        }
        ss << sum;
        return ss.str();
    }

    bool operator<(const Account &another) const
    {
        if(sum == another.sum){
            return time > another.time;
        }else{
            return sum < another.sum;
        }
    }
};

ll COUNT[30];
ll calc_score(ll id, ll star){
    COUNT[id]++;
    ll rank = COUNT[id];
    return 50 * star + (50 * star) / (0.8 + 0.2 * rank);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    cin >> N;

    vector<ll> L(N);
    FOR(i, 0, N){
        cin >> L.at(i);
    }

    ll T;
    cin >> T;

    map<string, Account> mp;

    FOR(i, 0, T){
        string name;
        char P;
        cin >> name >> P;

        ll id = P - 'A';
        ll star = L[id];
        ll score = calc_score(id, star);

        mp[name].name = name;
        mp[name].AddScore(id, score);
        mp[name].time = i;
    }

    vector<Account> V;
    for(auto p : mp){
        V.push_back(p.second);
    }
    sort(ALL(V));
    reverse(ALL(V));
    FOR(i, 0 ,V.size()){
        cout << i+1 << " " << V[i].ToString() << endl;
    }
    
    return 0;
}
0