QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#588986#9370. Gambling on Choosing RegionalslixiaolinWA 0ms3784kbC++14808b2024-09-25 15:34:012024-09-25 15:34:02

Judging History

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

  • [2024-09-25 15:34:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3784kb
  • [2024-09-25 15:34:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
unordered_map<string,vector<int>>mp;
unordered_map<int,int>ans;
int w[112121];
vector<int>rnk;
int main()
{
	int n,m;
	cin>>n>>m;
	int mn=1e9+7;
	for(int i=0;i<m;i++){int x;cin>>x;mn=min(x,mn);	}
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>w[i]>>s;
		mp[s].push_back(w[i]);
	 } 
	for(auto  [s,v]:mp)
	{
		sort(v.begin(),v.end(),greater<int>());
		for(int i=0;i<min(mn,int(v.size()));i++)rnk.push_back(v[i]);
	}
	sort(rnk.begin(),rnk.end(),greater<int>());
	for(int i=0;i<rnk.size();i++)ans[rnk[i]]=i+1;
	for(auto  [s,v]:mp)
	{
		for(int i=mn;i<v.size();i++)
		{
			ans[v[i]]=lower_bound(rnk.begin(),rnk.end(),v[i],greater<int>())-rnk.begin();
		}
	}
	for(int i=0;i<n;i++)cout<<ans[w[i]]<<"\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
0
2
1
0

result:

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