結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー pekempeypekempey
提出日時 2016-11-18 22:43:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,124 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 186,952 KB
実行使用メモリ 4,540 KB
最終ジャッジ日時 2023-08-17 11:11:28
合計ジャッジ時間 3,699 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

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

struct Tuple {
    int score[26] = {};
    int sum = 0;
    int last = INT_MAX;

    void set_score(int k, int v, int t) {
        score[k] = v;
        sum += v;
        last = t;
    }
};

bool operator<(const Tuple &a, const Tuple &b) {
    if (a.sum != b.sum) return a.sum > b.sum;
    return a.last < b.last;
}

int main() {
    int n, T;
    cin >> n;
    vector<int> L(n);
    for (int i = 0; i < n; i++) scanf("%d", &L[i]);
    cin >> T;
    map<string, Tuple> score;
    vector<int> cnt(n);
    for (int ii = 0; ii < T; ii++) {
        string name, prob;
        cin >> name >> prob;
        int id = prob[0] - 'A';
        cnt[id]++;
        score[name].set_score(id, 50 * L[id] + 500 * L[id] / (8 + 2 * cnt[id]), ii);
    }

    vector<pair<Tuple, string>> v;
    for (auto kv : score) v.emplace_back(kv.second, kv.first);
    sort(v.begin(), v.end());

    for (int i = 0; i < v.size(); i++) {
        cout << i + 1 << " " << v[i].second << " ";
        for (int j = 0; j < n; j++) cout << v[i].first.score[j] << " ";
        cout << v[i].first.sum << endl;
    }
}
0