必威体育Betway必威体育官网
当前位置:首页 > IT技术

1025

时间:2019-08-22 18:41:07来源:IT技术作者:seo实验室小编阅读:87次「手机版」
 

1025

#include<string>
#include<iOStream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;

class Inform
{
public:
	static int sum;
	string registration_number;
	int final_rank, location_number, local_rank, score;
};
bool compare(Inform a, Inform b)
{
	if (a.score == b.score)
		return a.registration_number < b.registration_number;
	else
		return a.score > b.score;
}
int Inform::sum = 0;
void Rank(vector<Inform> &A,int c);
void Rank(vector<Inform> &A);
int main()
{
	vector<Inform> A[110];
	int n,c;
	cin >> n;
	c = 1;
	
	while (c <= n)
	{
		int k;
		cin >> k;
		Inform a;
		Inform::sum += k;
		while (k--)
		{
			cin >> a.registration_number >> a.score;
			A[c].push_back(a);
		}
		if (!A[c].empty())
		{
			sort(A[c].begin(), A[c].end(), compare);
			Rank(A[c], c);
			A[0].insert(A[0].end(), A[c].begin(), A[c].end());
		}
		c++;
	}
	if (!A[0].empty())
	{
		sort(A[0].begin(), A[0].end(), compare);
		Rank(A[0]);
	}
	cout << Inform::sum << endl;
	for (auto iter = A[0].begin(); iter != A[0].end(); iter++)
	{
		cout << iter->registration_number << ' ' << iter->final_rank << ' ' << iter->location_number << ' ' << iter->local_rank << endl;
	}
	system("pause");
	return 0;
}
void Rank(vector<Inform> &A)
{
	int rank, allr, score;
	rank = allr = 1;
	score = A.begin()->score;
	for (auto iter = A.begin(); iter != A.end(); iter++, allr++)
	{
		if (iter->score < score)
		{
			score = iter->score;
			rank = allr;
		}
		iter->final_rank = rank;
	}

}
void Rank(vector<Inform> &A,int c)
{
	int rank, allr, score;
	rank = allr = 1;
	score = A.begin()->score;
	for (auto iter = A.begin(); iter != A.end(); iter++, allr++)
	{
		iter->location_number = c;
		if (iter->score < score)
		{
			score = iter->score;
			rank = allr;
		}
		iter->local_rank = rank;
	}
}

相关阅读

【帝国时代2HD】蛮王崛起修改器-20181025

20181025更正左侧的检查更新按钮皮皮盘(推荐,一次只下载一个文件就不会提示vip或注册,比百度微云快)https://datoumaomi.pipipan.

分享到:

栏目导航

推荐阅读

热门阅读