QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#584800#9370. Gambling on Choosing RegionalsChief_NingWA 0ms3608kbC++14533b2024-09-23 16:48:542024-09-23 16:48:54

Judging History

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

  • [2024-09-23 16:48:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3608kb
  • [2024-09-23 16:48:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int c=1e9;
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		c=min(x,c);
	}
	vector<int> w(n+1),id(n+1);
	vector<string> s(n+1);
	for(int i=1;i<=n;i++){
		cin>>w[i]>>s[i];
		id[i]=i;
	}
	sort(id.begin()+1,id.end(),[&](int x,int y){
		return w[x]>w[y];
	});
	map<string,int>p;
	int tot=0;
	for(int i=1;i<=n;i++){
		int x=id[i];
		w[x]=tot+1-(p[s[x]]==c);
		if(p[s[x]]<c)p[s[x]]++,tot++;
	}
	for(int i=1;i<=n;i++)cout<<w[i]<<" ";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

2 1 2 2 1 

result:

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