結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー kotatsugamekotatsugame
提出日時 2016-11-18 23:41:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,371 bytes
コンパイル時間 1,525 ms
コンパイル使用メモリ 97,020 KB
実行使用メモリ 4,632 KB
最終ジャッジ日時 2023-08-17 12:15:13
合計ジャッジ時間 2,928 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<set>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

int n;
int l[26];
int counter[26]={};

class man
{
public:
	string name;
	int score[26];
	int allscore;
	int lasttime;
	man()
	{
		name="";
		allscore=0;
		lasttime=0;
		for(int i=0;i<26;i++)score[i]=0;
	}
	bool operator<(const man m)const
	{
		return allscore==m.allscore?lasttime<m.lasttime:allscore>m.allscore;
	}
	void print(int a)
	{
		cout<<a<<" "<<name;
		for(int i=0;i<n;i++)
		{
			cout<<" "<<score[i];
		}
		cout<<" "<<allscore<<endl;
		return;
	}
};

int main() {
	map<string,man> m;
	cin>>n;
	for(int i=0;i<n;i++)cin>>l[i];
	int t;
	cin>>t;
	string name;
	char p;
	for(int i=0;i<t;i++)
	{
		cin>>name>>p;
		double fir=(50*l[p-'A'])/(0.8+0.2*(++counter[p-'A'])-(1e-10));
		int las=int(fir)+50*l[p-'A'];
		auto it=m.find(name);
		if(it==m.end())
		{
			man in;
			in.name=name;
			in.score[p-'A']+=las;
			in.allscore+=las;
			in.lasttime=i;
			m.insert(make_pair(name,in));
		}
		else
		{
			pair<string,man> in=*it;
			in.second.score[p-'A']+=las;
			in.second.allscore+=las;
			in.second.lasttime=i;
			m.erase(name);
			m.insert(in);
		}
	}
	int count=0;
	vector<man> pri;
	pair<string,man> out;
	for(auto i:m)
	{
		out=i;
		pri.push_back(out.second);
	}
	sort(pri.begin(),pri.end());
	for(int i=0;i<pri.size();i++)pri[i].print(++count);
	return 0;
}
0