QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#586035#9370. Gambling on Choosing RegionalsAbclWA 12ms58300kbC++141.0kb2024-09-24 00:12:212024-09-24 00:12:21

Judging History

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

  • [2024-09-24 00:12:21]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:58300kb
  • [2024-09-24 00:12:21]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
const int N=1000005;
int n,k;
map<string,int> mp;//学校去的队伍数
struct node{
	int w,id,rank;
	string s;
}a[N];
bool cmp(node x,node y){
	return x.w>y.w;
}
bool cmp1(node x,node y){
	return x.id<y.id;
}
void solve(){
	cin>>n>>k;
	int minl=1e15;
	for(int i=1,x;i<=k;i++){
		cin>>x;minl=min(minl,x);
	}
	for(int i=1;i<=n;i++){
		cin>>a[i].w>>a[i].s;
		a[i].id=i;
	}
	sort(a+1,a+1+n,cmp);
	int d=0;
	//把所有队伍全部塞进这个赛区
	for(int i=1;i<=n;i++){
		a[i].rank=i-d;//计算排名
		if(mp[a[i].s]>=minl){
		 	a[i].rank--;//本校名额超了就让前边出队一个
			mp[a[i].s]++;
			d++;
		}
	}
	sort(a+1,a+1+n,cmp1);
	for(int i=1;i<=n;i++){
		cout<<a[i].rank<<endl;
	}
	return;
}
signed main() {
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int T_case=1;
	//cin>>T_case;
	while(T_case--){
		solve();
	}
    return 0;
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 12ms
memory: 58300kb

input:

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

output:

4
2
5
3
1

result:

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