QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#583428#9370. Gambling on Choosing RegionalsLine_MaoCompile Error//C++981.1kb2024-09-22 19:55:152024-09-22 19:55:17

Judging History

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

  • [2024-09-22 19:55:17]
  • 评测
  • [2024-09-22 19:55:15]
  • 提交

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 (map<string, vector<int>>::iterator it = mp.begin(); it != mp.end(); it++)
	{
		sort(it->second.begin(), it->second.end());
	}

	for (int i = 0; i < n; i++)
	{
		int ans = 1;
		for (map<string, vector<int>>::iterator it = mp.begin(); it != mp.end(); it++)
		{
			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;
					}
				}
			}
		}
		cout << ans << endl;
	}
}



Details

answer.code: In function ‘int main()’:
answer.code:18:31: error: ‘>>’ should be ‘> >’ within a nested template argument list
   18 |         map<string, vector<int>>mp;
      |                               ^~
      |                               > >
answer.code:25:36: error: ‘>>’ should be ‘> >’ within a nested template argument list
   25 |         for (map<string, vector<int>>::iterator it = mp.begin(); it != mp.end(); it++)
      |                                    ^~
      |                                    > >
answer.code:33:44: error: ‘>>’ should be ‘> >’ within a nested template argument list
   33 |                 for (map<string, vector<int>>::iterator it = mp.begin(); it != mp.end(); it++)
      |                                            ^~
      |                                            > >