CF19A 第4个点WA
  • 板块学术版
  • 楼主frz_fw
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/16 22:07
  • 上次更新2024/7/17 08:32:43
查看原帖
CF19A 第4个点WA
1101283
frz_fw楼主2024/7/16 22:07
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;
int n;
struct stu{
	long long sq;
	long long df;
        long long jq;
	string name;
}t[55];
bool cmp1(const stu &x,const stu &y){
	if(x.df>y.df) return true;
	else if(x.df<y.df) return false;
	else
		if(x.sq>y.sq) return true;
		else if(x.sq<y.sq) return false;
		else
			if(x.jq>y.jq) return true;
			else return false;
}
bool cmp2(const stu &x,const stu &y){
	if(x.name<y.name) return true;
	else return false;
}
int main(){
	cin>>n;
	int n2=n*(n-1)/2;
	for(int i=1;i<=n;i++) cin>>t[i].name;
	for(int i=1;i<=n2;i++){
		string a,b;
		cin>>a;
		b=a.substr(a.find('-')+1);
		a=a.substr(0,a.find('-'));
		long long d,f;
		char e;
		cin>>d>>e>>f;
		for(int j=1;j<=n;j++)
			if(t[j].name==a)
				if(d>f){
					t[j].sq+=(d-f);
					t[j].df+=3;
					t[j].jq+=d;
				}
				else{
					t[j].df++;
					t[j].jq+=d;
				}
			else if(t[j].name==b)
				if(f>d){
					t[j].sq+=(f-d);
					t[j].df+=3;
					t[j].jq+=f;
				}
				else{
					t[j].df++;
					t[j].jq+=f;
				}
	}
	sort(t+1,t+n+1,cmp1);
	sort(t+1,t+n/2+1,cmp2);
	for(int i=1;i<=n/2;i++) cout<<t[i].name<<endl;
	return 0;
}
2024/7/16 22:07
加载中...