結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー NasatameNasatame
提出日時 2016-11-18 23:40:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,556 bytes
コンパイル時間 1,082 ms
コンパイル使用メモリ 95,640 KB
実行使用メモリ 4,676 KB
最終ジャッジ日時 2023-08-17 12:14:58
合計ジャッジ時間 2,549 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int formula(int star,int n){
    return 50*star + 50*star/(0.8 + 0.2 * n);
}

class par{
public:
    string name;
    int updata;
    int p;
    
    par(string n,int u,int point){
        name = n;
        updata = u;
        p = point;
    }
};

int main(void){
    // Here your code !
    int n;
    cin >> n;
    vector<int> star(n);
    vector<int> ac(n,1);
    for(int i = 0; i < n; i++) cin >> star[i];
    
    map<string,vector<int>> number;
    map<string,int> updata;
    
    int t;
    cin >> t;
    
    for(int i = 0; i < t; i++){
        string s;
        char a;
        cin >> s;
        cin >> a;
        a -= 'A';
        if(number[s].size() == 0) number[s] = vector<int>(n,0);
        number[s][a] = formula(star[a],ac[a]++);
        updata[s] = i;
    }
    
    //最終順位付け
    
    vector<par> rank;
    
    for( auto i = number.begin() ; i != number.end() ; i++){
        int tmp = 0;
        for(int j = 0; j < n; j++)
            tmp += i->second[j];
        
        rank.push_back(par(i->first,updata[i->first],tmp));
    }
    
    sort(rank.begin(),rank.end(),[](const par& a,const par& b){
        return a.p == b.p ? a.updata < b.updata : a.p > b.p;
    });
    
    for(int i = 0; i < rank.size(); i++){
        cout << i+1 << " " << rank[i].name << " ";
        for(int j = 0; j < n; j++)cout << number[rank[i].name][j] << " ";
        cout << rank[i].p << endl;
    }
    
}
0