30分RE求助
查看原帖
30分RE求助
737345
wfy123654楼主2024/10/13 13:25
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull n,m,A[200000],B[200000],C[200000];
ull maxa,maxb,maxc,s1[200000],s2[200000],s3[200000];
struct student
{
	ull a,b,c;
}s[200001];
bool cmp(int x,int y)
{
	return x>y;
}
int main()
{
	cin>>n;
	for(ull i=0;i<n;i++)
	{
		cin>>s[i].a>>s[i].b>>s[i].c;
		s1[i]=s[i].a;
		s2[i]=s[i].b;
		s3[i]=s[i].c;
		if(s[i].a>maxa) maxa=s[i].a;
		if(s[i].b>maxb) maxb=s[i].b;
		if(s[i].c>maxc) maxc=s[i].c;
	}
	
	sort(s1,s1+n,cmp);
	sort(s2,s2+n,cmp);
	sort(s3,s3+n,cmp);
	
	/*cout<<endl; 
	for(int j=0;j<n;j++) printf("%d %d %d\n",s1[j].a,s1[j].b,s1[j].c);
	cout<<endl;
	for(int j=0;j<n;j++) printf("%d %d %d\n",s2[j].a,s2[j].b,s2[j].c);
	cout<<endl;
	for(int j=0;j<n;j++) printf("%d %d %d\n",s3[j].a,s3[j].b,s3[j].c);
	cout<<endl;*/
	
	for(ull j=0;j<n;j++)
	{
		if(A[s1[j]]==0)
		{
			A[s1[j]]=j+1;
			//cout<<"A["<<s1[j].a<<"]="<<A[s1[j].a]<<endl;
		}
		if(B[s2[j]]==0)
		{
			B[s2[j]]=j+1;
			//cout<<"B["<<s2[j].b<<"]="<<B[s2[j].b]<<endl;
		}
		if(C[s3[j]]==0)
		{
			C[s3[j]]=j+1;
			//cout<<"C["<<s3[j].c<<"]="<<C[s3[j].c]<<endl;
		}
	}
	for(ull i=0;i<n;i++)
	{
		cout<<min(A[s[i].a],min(B[s[i].b],C[s[i].c]))<<endl;
	}
	return 0;
}
2024/10/13 13:25
加载中...