結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| コンテスト | |
| ユーザー |
Ashurnasirpal
|
| 提出日時 | 2016-11-18 22:59:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 1,335 bytes |
| コンパイル時間 | 1,930 ms |
| コンパイル使用メモリ | 177,964 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-26 07:42:52 |
| 合計ジャッジ時間 | 3,012 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int ac[30] = {};
int l[30];
struct node{
string name;
int score[30];
int tot;
int t;
bool operator < (const node &right) const{
if(tot != right.tot)
return tot > right.tot;
else
return t < right.t;
}
};
map<string, node> res;
int calc(int n,int m){
return (int)floor(50*n + (50*n)/(0.8 + 0.2*m));
}
int main(void){
int n,t;
cin >> n;
for(int i = 0;i < n;++i){
cin >> l[i];
}
cin >> t;
for(int i = 0;i < t;++i){
string name;
char prob;
cin >> name >> prob;
if(res.find(name) == res.end()){
node n;
n.name = name;
fill(n.score, n.score+30,0);
n.tot = 0;
res[name] = n;
}
int p = prob - 'A';
++ac[p];
int score = calc(l[p],ac[p]);
node update = res[name];
update.score[p] = score;
update.tot += score;
update.t = i+1;
res[name] = update;
}
vector < node > rank;
for(map<string, node>::iterator itr = res.begin();
itr != res.end();++itr){
rank.push_back(itr->second);
}
sort(rank.begin(),rank.end());
for(int i = 0;i < (int)rank.size();++i){
cout << i+1;
cout << " " <<rank[i].name;
for(int j = 0;j < n;++j){
cout << " " << rank[i].score[j];
}
cout << " " << rank[i].tot;
cout << endl;
}
return 0;
}
Ashurnasirpal