結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー Naoyk1212
提出日時 2017-04-20 19:02:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,447 bytes
コンパイル時間 2,802 ms
コンパイル使用メモリ 186,580 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 21:14:51
合計ジャッジ時間 8,485 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;
#define int long long

vector<pair<int, int> > difficulty;
map<string, vector<int> > score;
vector<pair<int, string> > standing;
int n;

void check(string name){
	bool ok = false;
	for(auto a : score){
		if(a.first == name) ok = true;
	}
	
	if(ok == false){
		for(int i = 0; i < n; i++){
			score[name].push_back(0);
		}
	}
}

void solve(string name, char c){
	check(name);
	int diff = c - 'A';
	int point = 50 * difficulty[diff].first + (50 * difficulty[diff].first) / (0.8 + 0.2 * difficulty[diff].second);
	difficulty[diff].second++;
	score[name].erase(score[name].begin() + diff);
	score[name].insert(score[name].begin() + diff, point);
}

signed main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		difficulty.push_back(make_pair(a, 1));
	}

	int t;
	cin >> t;
	for(int i = 0; i < t; i++){
		string str;
		char p;
		cin >> str >> p;
		solve(str, p);
	}

	for(auto a : score){
		string name = a.first;
		int sum = 0;
		for(int i = 0; i < a.second.size(); i++){
			sum += a.second[i];
		}
		standing.push_back(make_pair(sum, name));
	}

	sort(standing.begin(), standing.end(), greater<pair<int, string> >());

	for(int i = 0; i < standing.size(); i++){
		string name = standing[i].second;
		cout << i + 1 << " " << name;
		for(int j = 0; j < score[name].size(); j++){
			cout << " " << score[name][j];
		}
		cout << " " << standing[i].first << endl;
	}
}
0