結果

問題 No.447 ゆきこーだーの雨と雪 (2)
コンテスト
ユーザー himueu
提出日時 2026-10-22 17:18:29
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 12 ms / 2,000 ms
+ 514µs
コード長 1,524 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,480 ms
コンパイル使用メモリ 214,308 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-10-22 17:18:36
合計ジャッジ時間 5,510 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

struct Result {
    std::string name;
    std::vector<int> score;
    int score_sum = 0, last_ac = -1;
};

int main() {
    using namespace std;
    int n;
    cin >> n;
    vector<int> l(n);
    for (auto &e : l) { cin >> e; }

    map<string, int> mp;
    vector<Result> result;
    vector<int> solved(n, 0);
    auto calc_score = [&](int n, int k) -> int {
        return (50 * n) + (500 * n) / (8 + 2 * k);
    };

    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        string name;
        char p;
        cin >> name >> p;
        if (!mp.contains(name)) {
            mp[name] = result.size();
            Result res;
            res.name = name;
            res.score.resize(n);
            result.push_back(res);
        }
        int id = mp[name], prob = p - 'A';
        int s = calc_score(l[prob], ++solved[prob]);
        result[id].score[prob] += s;
        result[id].score_sum += s;
        result[id].last_ac = i;
    }

    sort(result.begin(), result.end(), [](const Result lhs, const Result rhs) {
        if (lhs.score_sum != rhs.score_sum) {
            return lhs.score_sum > rhs.score_sum;
        } else {
            return lhs.last_ac < rhs.last_ac;
        }
    });

    int m = result.size();
    for (int i = 0; i < m; i++) {
        auto res = result[i];
        cout << i + 1 << " " << res.name << " ";
        for (int e : res.score) { cout << e << " "; }
        cout << res.score_sum << "\n";
    }
}
0