結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2017-08-01 21:06:50 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 1,767 bytes |
| コンパイル時間 | 1,322 ms |
| コンパイル使用メモリ | 109,448 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-11 00:17:25 |
| 合計ジャッジ時間 | 2,700 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, string> pls;
int L[30];
int prob_rank[30];
int num = 1;
map<char, int> prob;
map<string, int> m;
map<char, int>prob_no;
struct data_t{
ll score[30];
string name;
int rank;
ll sum = 0;
bool operator<(const data_t& right)const {
return sum > right.sum;
}
};
int main()
{
int n,t; cin >> n;
for (int i = 0; i < n; i++)
cin >> L[i];
for (int i = 0, c = 'A'; i < n; i++,c++)
prob[c] = L[i];
for (int i = 1, c = 'A'; i <= n; i++, c++)
prob_no[c] = i;
cin >> t;
vector<data_t> player(t+1);
for (int i = 0; i < t; i++) {
string name;
char c;
cin >> name >> c;
if (!m[name]) {
m[name] = num++;
}
prob_rank[prob_no[c]]++;
player[m[name]-1].name = name;
player[m[name]-1].score[prob_no[c]] = 50 * prob[c] + 50*prob[c] / (0.8 + 0.2*prob_rank[prob_no[c]]);
player[m[name]-1].sum += player[m[name]-1].score[prob_no[c]];
player[m[name] - 1].rank = i;
}
sort(player.begin(),player.end());
for (int i = 0; i < num - 2; i++) {
for (int j = i + 1; j < num - 1; j++) {
if (player[i].sum == player[j].sum) {
if (player[i].rank > player[j].rank) {
swap(player[i], player[j]);
}
}
}
}
for (int i = 0; i < num-1; i++) {
cout << i+1 << " " << player[i].name <<" ";
for (int j = 1; j <= n; j++) {
cout << player[i].score[j] << " ";
}
cout << player[i].sum << endl;
}
return 0;
}