結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー ytftytft
提出日時 2021-03-30 16:24:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 1,275 bytes
コンパイル時間 2,572 ms
コンパイル使用メモリ 195,168 KB
実行使用メモリ 4,620 KB
最終ジャッジ日時 2023-08-20 12:58:57
合計ジャッジ時間 4,379 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> L(N);
    for(int i=0;i<N;i++){
        cin>>L[i];
    }
    int T;
    cin>>T;
    int temp;
    string name;
    int people=0;
    char P;
    map<string,int> m,last;
    map<int,string> revm;
    vector<int> answered(N);
    vector<vector<int>> ans(0,vector<int>(N+2));
    for(int i=0;i<T;i++){
        cin>>name>>P;
        if(!m.count(name)){
            m[name]=people;
            revm[people]=name;
            people++;
            ans.push_back(vector<int>(N+2));
            ans[people-1][0]=people-1;
        }
        last[name]=i;
        answered[P-'A']++;
        temp=50*L[P-'A']+250*L[P-'A']/(4+answered[P-'A']);
        ans[m[name]][P-'A'+1]=temp;
        ans[m[name]][N+1]+=temp;
    }
    auto fn=[&](vector<int>& a,vector<int>& b){
        if(a[N+1]==b[N+1]){
            return last[revm[a[0]]]<last[revm[b[0]]];
        }
        return a[N+1]>b[N+1];
    };
    sort(ans.begin(),ans.end(),fn);
    for(int i=1;i<=people;i++){
        cout<<i<<" ";
        cout<<revm[ans[i-1][0]]<<" ";
        for(int j=1;j<N+2;j++){
            cout<<ans[i-1][j];
            if(j!=N+1){
                cout<<" ";
            }
        }
        cout<<endl;
    }
}
0