結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー けーむけーむ
提出日時 2020-08-14 15:09:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 1,918 bytes
コンパイル時間 2,287 ms
コンパイル使用メモリ 182,864 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 18:38:59
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 4 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 15 ms
5,376 KB
testcase_06 AC 18 ms
5,376 KB
testcase_07 AC 7 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 20 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 6 ms
5,376 KB
testcase_13 AC 16 ms
5,376 KB
testcase_14 AC 23 ms
5,376 KB
testcase_15 AC 4 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 22 ms
5,376 KB
testcase_20 AC 22 ms
5,376 KB
testcase_21 AC 5 ms
5,376 KB
testcase_22 AC 4 ms
5,376 KB
testcase_23 AC 5 ms
5,376 KB
testcase_24 AC 14 ms
5,376 KB
testcase_25 AC 20 ms
5,376 KB
testcase_26 AC 8 ms
5,376 KB
testcase_27 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

struct S {
    string name;
    vector<ll> score;
    vector<bool> clear;
    ll tot, upd;
    
    bool operator<(const S &b) const {
        if (tot != b.tot) return tot > b.tot;
        return upd < b.upd;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    vector<ll> cnt(n, 0);
    ll m;
    cin >> m;
    vector<S> users;
    rep(i, m) {
        string name;
        char prob;
        cin >> name >> prob;
        ll id = prob - 'A';
        ll user = -1;
        rep(j, sz(users)) {
            if (users[j].name == name) {
                user = j;
                break;
            }
        }
        if (user == -1) {
            user = sz(users);
            users.push_back((S){name, vector<ll>(n, 0), vector<bool>(n, false), 0, LONG_LONG_MIN});
        }
        if (!users[user].clear[id]) {
            cnt[id]++;
            users[user].clear[id] = true;
            users[user].score[id] = 50 * l[id] + 50 * l[id] / (0.8 + 0.2 * cnt[id]);
            users[user].upd = i;
            users[user].tot += users[user].score[id];
        }
    }
    sort(all(users));
    rep(i, sz(users)) {
        printf("%lld %s", i + 1, users[i].name.c_str());
        rep(j, n) printf(" %lld", users[i].score[j]);
        printf(" %lld\n", users[i].tot);
    }
    return 0;
}
0