結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー face4face4
提出日時 2018-09-19 15:15:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 1,499 bytes
コンパイル時間 1,571 ms
コンパイル使用メモリ 102,684 KB
実行使用メモリ 4,776 KB
最終ジャッジ日時 2023-09-25 10:09:29
合計ジャッジ時間 3,216 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 5 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 15 ms
4,472 KB
testcase_06 AC 18 ms
4,680 KB
testcase_07 AC 9 ms
4,380 KB
testcase_08 AC 11 ms
4,376 KB
testcase_09 AC 18 ms
4,652 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 5 ms
4,384 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 16 ms
4,504 KB
testcase_14 AC 19 ms
4,776 KB
testcase_15 AC 6 ms
4,376 KB
testcase_16 AC 5 ms
4,376 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 21 ms
4,628 KB
testcase_20 AC 20 ms
4,712 KB
testcase_21 AC 6 ms
4,376 KB
testcase_22 AC 6 ms
4,380 KB
testcase_23 AC 7 ms
4,376 KB
testcase_24 AC 14 ms
4,376 KB
testcase_25 AC 19 ms
4,568 KB
testcase_26 AC 9 ms
4,376 KB
testcase_27 AC 8 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

int n;

struct data{
public:
    string name;
    int lastsub, sum;
    vector<int> score;
    data() {};
    data(string na, int ls, int s){
        name = na;
        lastsub = ls;
        sum = s;
        score.resize(26, 0);
    };

    bool operator<(const data other) const{
        if(sum != other.sum)    return sum > other.sum;
        else                    return lastsub < other.lastsub;
    }

    void print(){
        cout << name;
        for(int i = 0; i < n; i++)  cout << " " << score[i];
        cout << " " << sum << endl;
    }
};

int main(){
    cin >> n;

    int l[n];
    for(int i = 0; i < n; i++)  cin >> l[i];

    int t;
    cin >> t;

    map<string, data> res;
    string name;
    char p;
    int ac[26] = {};

    for(int i = 0; i < t; i++){
        cin >> name >> p;
        int problem = p-'A';
        int getsc = 50*l[problem] + 250*l[problem]/(4 + ac[problem]+1);
        ac[problem]++;
        if(res.count(name)){
            res[name].lastsub = i;
            res[name].score[problem] = getsc;
            res[name].sum += getsc;
        }else{
            res[name] = data(name, i, getsc);
            res[name].score[problem] = getsc;
        }
    }

    vector<data> v;
    for(auto x : res)   v.push_back(x.second);
    sort(v.begin(), v.end());

    for(int i = 0; i < v.size(); i++){
        cout << i+1 << " ";
        v[i].print();
    }

    return 0;
}
0