結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
![]() |
提出日時 | 2021-03-30 16:24:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,275 bytes |
コンパイル時間 | 3,377 ms |
コンパイル使用メモリ | 195,948 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 14:59:14 |
合計ジャッジ時間 | 4,093 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#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;}}