比赛 不平凡的世界 评测结果 WAWWWWWWWW
题目名称 不平凡的boss 最终得分 10
用户昵称 运行时间 3.904 s
代码语言 C++ 内存使用 3.72 MiB
提交时间 2015-11-05 11:18:15
显示代码纯文本
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
long long a[100010],b[100010],c[100010],num[100010],minn[100010];
long long n,ansa=0,ansb=0,ansc=0,ans;
int main()
{
	freopen("playwithboss.in","r",stdin);
	freopen("playwithboss.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i];
	for(int i=1;i<=n;i++)
	{
		if(a[i]>b[i]&&b[i]>c[i]) {minn[i]=c[i];num[i]=3;}
		if(b[i]>a[i]&&a[i]>c[i]) {minn[i]=c[i];num[i]=3;}
		if(a[i]>c[i]&&c[i]>b[i]) {minn[i]=b[i];num[i]=2;}
		if(c[i]>a[i]&&a[i]>b[i]) {minn[i]=b[i];num[i]=2;}
		if(c[i]>b[i]&&b[i]>a[i]) {minn[i]=a[i];num[i]=1;}
		if(b[i]>c[i]&&c[i]>a[i]) {minn[i]=a[i];num[i]=1;}
	}
	for(int i=1;i<=n;i++)
	{
		if(num[i]==1)
			if(minn[i]>ansa) ansa=minn[i];
		if(num[i]==2)
			if(minn[i]>ansb) ansb=minn[i];
		if(num[i]==3)
			if(minn[i]>ansc) ansc=minn[i];
	}
	ans=ansa+ansb+ansc;
	cout<<ans<<endl;
	return 0;
}