30分求调
查看原帖
30分求调
1382457
8140luyihang楼主2025/6/15 09:34
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
//const int N=1e5+5;
//ll a[N];
ll n,l=0;
struct uuu{
	ll zf,yw,sx,yy,o,x,pm;
	
}a[1005];
bool spt(uuu x,uuu b)
{
	if(x.zf!=b.zf) return x.zf>b.zf;
 	else if(x.o!=b.o) return x.o>b.o;
 	else if(max(x.yw,x.sx)!=max(b.yw,b.sx))
 	{
 		return max(x.yw,x.sx)>(b.yw,b.sx);
	}
}
bool ppt(uuu b,uuu y)
{
	return b.x<y.x;
}
bool chack(int i)
{
	uuu x=a[i],b=a[i-1];
	if(x.zf!=b.zf||x.o!=b.o||max(x.yw,x.sx)!=max(b.yw,b.sx)) return 0;
	return 1;
}
void solve()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i].yw>>a[i].sx>>a[i].yy;
		a[i].zf=a[i].yw+a[i].sx+a[i].yy;
		a[i].o=a[i].yw+a[i].sx;
		a[i].x=i+1;
	}
	sort(a,a+n,spt);
	for(int i=0;i<n;i++)
	{
		if(chack(i))
		{
			a[i].pm=l;
		}
		else
		{
			l=i;
			a[i].pm=l;
		}
	}
	sort(a,a+n,ppt);
	for(int i=0;i<n;i++)
	{
		cout<<a[i].pm+1<<'\n';
	}
	
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	//freopen(" .in","r",stdin);
	//freopen(" .out","w",stdout);
	ll T=1;//cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}

样例对但30pts

2025/6/15 09:34
加载中...