結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー ytftytft
提出日時 2021-03-30 16:19:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,312 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 196,052 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-07 19:31:19
合計ジャッジ時間 3,817 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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;
    double 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.0*L[P-'A'];
        temp*=(1.0+1.0/(0.8+0.2*answered[P-'A']));
        ans[m[name]][P-'A'+1]=floor(temp);
        ans[m[name]][N+1]+=floor(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