結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| コンテスト | |
| ユーザー |
HO_RI1991
|
| 提出日時 | 2016-11-21 12:18:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 22 ms / 2,000 ms |
| コード長 | 2,210 bytes |
| コンパイル時間 | 1,543 ms |
| コンパイル使用メモリ | 128,812 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-27 09:26:36 |
| 合計ジャッジ時間 | 2,809 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<stack>
#include<set>
#include<sstream>
#include<fstream>
using namespace std;
const double pi=4*atan(1.0);
constexpr long long mod=static_cast<long long>(1e9+7);
using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;
struct Score{
long long score;
int last_ans;
vector<int> scores;
Score(int last,int N):last_ans(last),score(0),scores(N,0){}
};
int get_score(int star,int order){
return 50*star+(double)((50.*(double)(star))/(0.8+0.2*(double)(order)));
}
int main(){
// ifstream fin("gen_case_1.txt");
int N;
cin>>N;
vector<int> L(N);
for(auto& val:L)
cin>>val;
int T;
cin>>T;
vector<pair<string,int>> List(T);
unordered_map<string,Score> LastAns;
for(int i=0;i<T;++i){
char str;
cin>>List[i].first>>str;
List[i].second=str-'A';
auto itr=LastAns.find(List[i].first);
if(itr!=end(LastAns)){
itr->second.last_ans=i;
}
else{
LastAns.insert(make_pair(List[i].first,Score(i,N)));
}
}
vector<int> Num(N,0);
for(const auto& answer:List){
auto itr=LastAns.find(answer.first);
itr->second.score+=get_score(L[answer.second],++Num[answer.second]);
itr->second.scores[answer.second]=get_score(L[answer.second],Num[answer.second]);
}
vector<pair<string,long long>> Scores(LastAns.size());
auto itr=LastAns.begin();
for(int i=0;i<LastAns.size();++i){
Scores[i].first=itr->first;
Scores[i].second=itr->second.score;
++itr;
}
sort(begin(Scores),end(Scores),[&](auto x,auto y){
if(x.second==y.second){
auto x_itr=LastAns.find(x.first);
auto y_itr=LastAns.find(y.first);
return x_itr->second.last_ans<y_itr->second.last_ans;
}
else{
return x.second>y.second;
}
});
//ofstream fout("out.txt");
for(int i=0;i<Scores.size();++i){
cout<<i+1<<" "<<Scores[i].first;
auto itr=LastAns.find(Scores[i].first);
for(const auto& val:itr->second.scores){
cout<<" "<<val;
}
cout<<" "<<Scores[i].second<<endl;
}
return 0;
}
HO_RI1991