感觉都对了,实在找不到错(玄关)
查看原帖
感觉都对了,实在找不到错(玄关)
1266829
cjy2327134004楼主2024/10/20 18:38
#include<bits/stdc++.h>
using namespace std;
struct q{
	int a,id;
}h[100010]; 
bool w(q y,q t ){
	return y.a>t.a;
}
int main()
{
	int n,m,a,b,f,z,u=-1;
	cin>>n>>m>>a>>b;
	for(int i=1;i<=a;i++)
	{
		for(int o=1;o<=n;o++)
		{
			scanf("%d",&f);
			h[o].a+=f;
			h[o].id=o;
			if(i==b){
			if(f>u)
			{
				u=f;
				z=o;
			}
		}
		}
	}
	sort(h+1,h+n+1,w);
	bool x=0;
	for(int i=1;i<=m;i++)
	{
		if(z==h[i].id)x=1;
		break;
	}
	if(x)
	{
		cout<<z<<" ";
		for(int i=1;i<=m;i++)
		{
			if(h[i].id!=z)cout<<h[i].id<<" ";
		}
	}
	
	else
	{
		for(int i=1;i<m;i++)
		{
			cout<<h[i].id<<" ";
			cout<<z;
		}
	}
	
	return 0;
}
2024/10/20 18:38
加载中...