結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー okayunonahaokayunonaha
提出日時 2016-11-19 00:23:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,503 bytes
コンパイル時間 795 ms
コンパイル使用メモリ 69,072 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 13:14:00
合計ジャッジ時間 2,294 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

struct grd {
    string name;
    int last_ac, point;
    int p[27];
};

int N, L[27], Lsub[27], T, g_size = 0;
grd g[4002];

bool comp(const grd &g1, const grd &g2) {
    if(g1.point == g2.point) return g1.last_ac < g2.last_ac;
    return g1.point > g2.point;
}


int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    fill(Lsub, Lsub + 27, 1);
    string n;
    char p;
    bool flag = false;

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> L[i];
    }
    cin >> T;
    for(int i = 0; i < T; i++) {
        cin >> n >> p;
        flag = false;

        for(int j = 0; j < g_size; ++j) {
            if(g[j].name == n) {
                g[j].p[p - 'A'] = (int)(50*L[p-'A'] + (50*L[p-'A'] / (0.8 + 0.2 * Lsub[p-'A']++)));
                g[j].point+=g[j].p[p-'A'];
                g[j].last_ac = i;
                flag = true;
            }
        }
        if(!flag) {
            g[g_size].name = n;
            g[g_size].p[p-'A'] = (int)(50.0*L[p-'A'] + (50.0*L[p-'A'] / (0.8 + 0.2 * Lsub[p-'A']++)));
            g[g_size].point+=g[g_size].p[p-'A'];
            g[g_size].last_ac = i;
            g_size++;
        }
    }

    sort(g, g + g_size, comp);

    for(int i = 0; i < g_size; ++i) {
        cout << i+1 << " " << g[i].name << " ";
        for(int j = 0; j < N; ++j) {
            cout << g[i].p[j] << " ";
        }
        cout << g[i].point << endl;
    }
    return 0;
}
0