結果

問題 No.447 ゆきこーだーの雨と雪 (2)
コンテスト
ユーザー himueu
提出日時 2026-10-22 12:07:22
言語 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
+ 40µs
コード長 1,383 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,518 ms
コンパイル使用メモリ 206,352 KB
実行使用メモリ 9,872 KB
最終ジャッジ日時 2026-10-22 12:07:48
合計ジャッジ時間 5,942 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main() {
    using namespace std;
    int n;
    cin >> n;
    vector<int> l(n);
    for (auto &e : l) { cin >> e; }
    vector<string> names;
    map<string, int> mp;
    vector<int> solved(n, 0);
    vector<vector<int>> scores;
    auto f = [&](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 s;
        char p;
        cin >> s >> p;
        if (!mp.contains(s)) {
            names.push_back(s);
            mp[s] = scores.size();
            scores.push_back(vector<int>(n + 3, 0));
            scores[mp[s]][0] = mp[s];
        }
        int id = mp[s], prob = p - 'A';
        solved[prob]++;
        int score = f(l[prob], solved[prob]);
        scores[id][1] += score;
        scores[id][2] = i;
        scores[id][prob + 3] += score;
    }

    sort(scores.begin(), scores.end(), [](const auto lhs, const auto rhs) {
        if (lhs[1] != rhs[1]) { return lhs[1] > rhs[1]; }
        return lhs[2] < rhs[2];
    });

    int m = scores.size();
    for (int i = 1; i <= m; i++) {
        auto res = scores[i - 1];
        cout << i << " " << names[res[0]] << " ";
        for (int j = 3; j < n + 3; j++) { cout << res[j] << " "; }
        cout << res[1] << "\n";
    }
}
0