結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー kotamanegikotamanegi
提出日時 2016-11-18 23:05:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 2,518 bytes
コンパイル時間 1,239 ms
コンパイル使用メモリ 113,960 KB
実行使用メモリ 4,668 KB
最終ジャッジ日時 2023-08-17 11:35:21
合計ジャッジ時間 2,836 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
map<string, int> who;
map<int, string> deter;
int later[5000] = {};
int scores[5000][30] = {};
int now_insert = 1;
int ac_counter[30] = {};
int main() {
	int n;
	cin >> n;
	vector<int> l;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		l.push_back(tmp);
	}
	int t = 0;
	cin >> t;
	REP(i, t) {
		string a;
		char bb;
		cin >> a >> bb;
		int b = (int)bb;
		if (who[a] == 0) {
			who[a] = now_insert;
			deter[now_insert] = a;
			now_insert++;
		}
		b -= 'A';
		int calc = 50 * l[b];
		ac_counter[b]++;
		calc += (double)calc / (double)((double)0.8 + (double)0.2*(double)ac_counter[b]);
		scores[who[a]][b] = calc;
		later[who[a]] = i;
	}
	//整理
	vector<pair<int, int>> final_standing;
	for (int i = 1;i < now_insert;++i) {
		int ans = 0;
		for (int q = 0;q < n;++q) {
			ans += scores[i][q];
		}
		final_standing.push_back(make_pair(ans,i));
	}
	sort(final_standing.begin(), final_standing.end(),greater<pair<int,int>>());
	for (int i = 0;i < now_insert - 1;++i) {
		if (i != now_insert-2&&final_standing[i].first == final_standing[i + 1].first) {
			vector<pair<int,int>> ranked;
			ranked.push_back(make_pair(later[final_standing[i].second], final_standing[i].second));
			while (true) {
				if (i == now_insert - 2) break;
				if (final_standing[i].first != final_standing[i + 1].first) break;
				ranked.push_back(make_pair(later[final_standing[i+1].second],final_standing[i+1].second));
				i++;
			}
			sort(ranked.begin(), ranked.end());
			for (int q = 0;q < ranked.size();++q) {
				int wowow = i + q+2;
				wowow -= ranked.size();
				cout << wowow << " " << deter[ranked[q].second];
				int too = 0;
				REP(j, n) {
					cout << " " << scores[ranked[q].second][j];
					too += scores[ranked[q].second][j];
				}
				cout << " " << too << endl;
			}
		}
		else {
			cout << i + 1 << " " << deter[final_standing[i].second];
			REP(q, n) {
				cout << " " << scores[final_standing[i].second][q];
			}
			cout << " " << final_standing[i].first << endl;
		}
	}
	return 0;
}
0