結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー TonyMoooriTonyMooori
提出日時 2016-11-18 23:25:25
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 2,523 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 169,364 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-17 12:08:23
合計ジャッジ時間 3,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 12 ms
4,376 KB
testcase_06 AC 16 ms
4,380 KB
testcase_07 AC 9 ms
4,376 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 16 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 14 ms
4,380 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 5 ms
4,376 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 19 ms
4,380 KB
testcase_20 AC 16 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,380 KB
testcase_24 AC 13 ms
4,380 KB
testcase_25 AC 17 ms
4,380 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 8 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t

typedef struct _data_t{
    string name;
    bool solved[32];
    int time;
    int points[32];
    int sum;
    double sort_num;
    
    bool operator<( const _data_t& right ) const {
        return sort_num < right.sort_num;
    }
} data_t;



data_t make_empty(){
    data_t dat;
    dat.name = "";
    for(int i = 0 ; i < 32 ; i++ ){
        dat.points[i] = 0;
        dat.solved[i] = false;
    }
    
    dat.time = 0;
    dat.sum = 0;
    dat.sort_num = 0.0;
    
    return dat;
}


int f(int n,int k){
    return 50 * n + int(250 * n/(4+k));
}

int main(void){
    int N;
    cin >>N;
    int n_star[N];
    for(int i = 0 ; i < N ; i++ )
        cin >> n_star[i];
    int T;
    int rank[N];
    for(int i = 0 ; i < N ; i++ )
        rank[i] = 1;
    cin >> T;
    vector<data_t> datas;
    map< string, int > name_index;
    
    for(int i = 0 ; i < T ; i++ ){
        string username,pname;
        cin >> username >> pname;
        int pn = ((int)(pname[0]))-(int)'A';
        if( name_index.find(username) == name_index.end()) {
            name_index[ username ] = datas.size();
            
            data_t dat = make_empty();
            
            dat.name = username;
            dat.solved[pn] = true;
            dat.time = i;
            dat.points[pn] = f( n_star[pn] , rank[pn] );
            rank[pn]++;
            datas.push_back(dat);
        }else{
            int index = name_index[ username ];
            
            if( datas[index].solved[pn] != false )continue;
            //cout << "---" << username << pn << "*--" << datas[index].solved[pn] << endl;
            datas[index].solved[pn] = true;
            datas[index].time = i;
            datas[index].points[pn] = f( n_star[pn] , rank[pn] );
            rank[pn]++;
        }
    }
    
    for(int i = 0; i < datas.size() ; i++ ){
        for(int j = 0 ; j < N ; j++ )
            datas[i].sum += datas[i].points[j];
        // timeは小さいとスコアが上がる→でかいと減る
        datas[i].sort_num = datas[i].sum - datas[i].time / 5000.0;
    }
    
    sort(datas.begin(),datas.end());
    reverse(datas.begin(),datas.end());
    
    for(int i = 0; i < datas.size() ; i++ ){
        cout << i+1 << " " << datas[i].name << " ";
        for(int j = 0 ; j < N ; j++ ){
            cout <<  datas[i].points[j] << " "; 
        }
        
        cout <<  datas[i].sum << endl;;
    }
    
    
    
    return 0;
}
0