不知道哪个细节出错,急急急!!
查看原帖
不知道哪个细节出错,急急急!!
546597
ymyctsz楼主2023/12/19 18:16

测试数据

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
struct h{string c;int a,b;}f[1010];
int main()
{
	int n;n=read();
	for(int q,w,e,r,t,i=1;i<=n;i++){cin>>f[i].c>>q>>w>>e>>r>>t;f[i].a+=500+q+w+e+r+t;f[i].b=f[i].a-500;}
	for(int i=1;i<=n;i++)
	{
		long long ans1=n,ans2=1;
		for(int j=1;j<=n;j++)
		{
			if(i==j) continue;
			if(f[i].a>f[j].b)ans1--;
			else if(f[i].a==f[j].b&&f[i].c<=f[j].c) ans1--;
			if(f[i].b<f[j].a)ans2++;
			else if(f[i].a==f[j].b&&f[i].c>=f[j].c) ans2++;
		}
		cout<<ans1<<" "<<ans2<<endl;
	}
	return 0;
} 
 
2023/12/19 18:16
加载中...