結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー tabataba
提出日時 2017-05-18 10:00:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 1,172 bytes
コンパイル時間 2,702 ms
コンパイル使用メモリ 149,920 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 23:06:40
合計ジャッジ時間 6,239 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 183 ms
4,348 KB
testcase_06 AC 166 ms
4,348 KB
testcase_07 AC 20 ms
4,348 KB
testcase_08 AC 64 ms
4,348 KB
testcase_09 AC 232 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 5 ms
4,348 KB
testcase_12 AC 23 ms
4,348 KB
testcase_13 AC 179 ms
4,348 KB
testcase_14 AC 292 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 10 ms
4,348 KB
testcase_17 AC 5 ms
4,348 KB
testcase_18 AC 4 ms
4,348 KB
testcase_19 AC 207 ms
4,348 KB
testcase_20 AC 278 ms
4,348 KB
testcase_21 AC 10 ms
4,348 KB
testcase_22 AC 7 ms
4,348 KB
testcase_23 AC 7 ms
4,348 KB
testcase_24 AC 65 ms
4,348 KB
testcase_25 AC 131 ms
4,348 KB
testcase_26 AC 17 ms
4,348 KB
testcase_27 AC 13 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>

using namespace std;
int main(){
	int n;
	-scanf("%d",&n);
	vector<int> ar(n,1);
	vector<int> l(n);
	for(auto &i:l){
		-scanf("%d",&i);
	}
	int t;
	-scanf("%d",&t);
	map<string,tuple<array<int,26>,int,int>> nss;
	for(int i=0;i<t;i++){
		char _name[20],p;
		-scanf("%s %c",_name,&p);
		string name=_name;
		p-='A';
		if(nss.count(name)==0){
			auto& t=nss[name];
			get<0>(t).fill(0);
			get<1>(t)=0;
		}
		auto& t=nss[name];
		int score=50*l[p]+50*l[p]/(0.8+0.2*ar[p]);
		get<0>(t)[p]+=score;
		get<1>(t)+=score;
		get<2>(t)=i;
		ar[p]++;
	}
	for(int i=1;!nss.empty();i++){
		auto it=max_element(nss.begin(),nss.end(),[](auto a,auto b){
			return get<1>(a.second)==get<1>(b.second)?
				get<2>(a.second)>get<2>(b.second):
				get<1>(a.second)<get<1>(b.second);
			});
		auto t=*it;
		printf("%d %s ",i,t.first.c_str());
		for(int i=0;i<n;i++){
			printf("%d ",get<0>(t.second)[i]);
		}
		printf("%d\n",get<1>(t.second));
		nss.erase(it);
	}
	return 0;
}
0