比赛 20161114 评测结果 WWWWWWAWTW
题目名称 输出全靠花 最终得分 10
用户昵称 cwm大佬%%% 运行时间 2.990 s
代码语言 C++ 内存使用 1.29 MiB
提交时间 2016-11-14 11:42:07
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;

const int N=1000+10;

int x[N],y[N],z[N],w[N];
bool vis[N][N];

struct P{
	int a,b;
	double kxy,kyz,kzw;
	bool operator < (P x)const{
		if(kxy!=x.kxy)return kxy<x.kxy;
		if(kyz!=x.kyz)return kyz<x.kyz;
		return kzw<x.kzw;
	}
	bool operator == (P x)const{return (kxy==x.kxy)&&(kyz==x.kyz)&&(kzw==x.kzw);}
};
priority_queue<P>que;

int main()
{
	freopen("xumingshi.in","r",stdin);
	freopen("xumingshi.out","w",stdout);
	memset(vis,0,sizeof(vis));
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d%d%d%d",&x[i],&y[i],&z[i],&w[i]);
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(i!=j)
		que.push((P){i,j,
			y[i]-y[j]==0 ? 0 : (double)(x[i]-x[j])/(double)(y[i]-y[j]),
			z[i]-z[j]==0 ? 0 : (double)(y[i]-y[j])/(double)(z[i]-z[j]),
			w[i]-w[j]==0 ? 0 : (double)(z[i]-z[j])/(double)(w[i]-w[j])
		});
	P last=que.top();que.pop();
	vis[last.b][last.a]=1;
	int out=0,tot=1;
	while(!que.empty()){
		P now=que.top(); que.pop();
		if(vis[now.a][now.b])continue;
		vis[now.b][now.a]=1;
		//printf("%d %d %lf %lf %lf\n",now.a,now.b,now.kxy,now.kyz,now.kzw);
		if(now==last)tot++;
		else tot=1;
		if(tot>out)out=tot;
		last=now;
	}
	printf("%d",out);
	return 0;
}