結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー nksk38nksk38
提出日時 2017-08-01 21:06:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 1,767 bytes
コンパイル時間 1,283 ms
コンパイル使用メモリ 107,612 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 07:38:21
合計ジャッジ時間 2,728 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 7 ms
5,376 KB
testcase_04 AC 5 ms
5,376 KB
testcase_05 AC 29 ms
5,376 KB
testcase_06 AC 22 ms
5,376 KB
testcase_07 AC 12 ms
5,376 KB
testcase_08 AC 13 ms
5,376 KB
testcase_09 AC 26 ms
5,376 KB
testcase_10 AC 5 ms
5,376 KB
testcase_11 AC 7 ms
5,376 KB
testcase_12 AC 9 ms
5,376 KB
testcase_13 AC 24 ms
5,376 KB
testcase_14 AC 35 ms
5,376 KB
testcase_15 AC 8 ms
5,376 KB
testcase_16 AC 6 ms
5,376 KB
testcase_17 AC 8 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 31 ms
5,376 KB
testcase_20 AC 32 ms
5,376 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 8 ms
5,376 KB
testcase_23 AC 11 ms
5,376 KB
testcase_24 AC 18 ms
5,376 KB
testcase_25 AC 24 ms
5,376 KB
testcase_26 AC 14 ms
5,376 KB
testcase_27 AC 12 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0