QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#583484#9370. Gambling on Choosing RegionalsLine_MaoWA 0ms3732kbC++14961b2024-09-22 20:10:412024-09-22 20:10:42

Judging History

你现在查看的是最新测评结果

  • [2024-09-22 20:10:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3732kb
  • [2024-09-22 20:10:41]
  • 提交

answer

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

int main()
{
	int n, k; cin >> n >> k;
	vector<int>c(k);
	for (int i = 0; i < k; i++) {
		cin >> c[i];
	}
	sort(c.begin(),c.end());

	vector<int>a(n);
	vector<string>b(n);
	map<string, vector<int>>mp;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i];
		mp[b[i]].push_back(a[i]);
	}

	for (auto&mp1:mp)
	{
		sort(mp1.second.begin(), mp1.second.end());
	}

	for (int i = 0; i < n; i++)
	{
		int ans = 1;
		for (auto&it:mp)
		{
			if (it.first == b[i])
			{
				for (int j = c[0] - 1; j > 0; j--)
				{
					if (a[i] < it.second[mp[it.first].size() - j])
					{
						ans = ans + j;
						break;
					}
				}
			}
			else
			{
				for (int j = c[0]; j > 0; j--)
				{
					if (a[i] < it.second[mp[it.first].size() - j])
					{
						ans += j;
						break;
					}
				}
			}
		}
		printf("%d",ans);
	}
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3732kb

input:

5 3
1 2 3
100 THU
110 PKU
95 PKU
105 THU
115 PKU

output:

21221

result:

wrong answer 1st lines differ - expected: '2', found: '21221'