记录编号 202645 评测结果 AAAAAAAAAA
题目名称 [SYOI 2015] Asm_Def的模拟赛 最终得分 100
用户昵称 GravatarSatoshi 是否通过 通过
代码语言 C++ 运行时间 0.667 s
提交时间 2015-11-01 17:35:54 内存使用 0.68 MiB
显示代码纯文本
#include <fstream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <iomanip>
#include <stack>
#define N 310
using namespace std;
ifstream in("trib.in");
ofstream out("trib.out");
int n;
vector<int> H;
stack<int> S;
int val[N][N]={0};
bool vis[N]={0};
int ans1=0,ans2=0;
class point
{
public:
	int x;
	int y;
	void make(int a,int b)
	{
		x=a;
		y=b;
	}
	point operator +(const point a)
	{
		point b;
		b.x=x+a.x;
		b.y=y+a.y;
		return b;
	}
	point operator -(const point a)
	{
		point b;
		b.x=x-a.x;
		b.y=y-a.y;
		return b;
	}
	int operator *(const point a)
	{
		int solo;
		solo=x*a.x+y*a.y;
		return solo;
	}
	int operator ^(const point a)
	{
		int solo;
		solo=x*a.y-y*a.x;
		return solo;
	}
	void print()
	{
		out<<x<<' '<<y<<endl;
	}
}p[N];
class line
{
public:
	point o;
	int c;
	void print()
	{
		out<<o.x<<' '<<o.y<<' '<<c<<endl;
	}
};
bool opp(point a,point b)
{
	return a.x==b.x&&a.y<b.y;
}
bool check(point a,point b,point c)
{
	point t;
	bool flag=0;
	int sum;
	if(a.x>b.x)
	{
		t=a;
		a=b;
		b=t;
	}
	sum=(a-b)^(c-b);
	if(sum>0&&a.x<=c.x&&c.x<=b.x)return 1;
	return 0;
}
void work()
{
	int i,j,k;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(i==j)continue;
			if(opp(p[j],p[i]))val[i][i]++;
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			for(k=1;k<=n;k++)
			{
				if(k==i||k==j)continue;
				if(check(p[i],p[j],p[k]))
				{
					val[i][j]++;
					val[j][i]++;
				}
			}
		}
	}
}
void MMORPG()
{
	int i,j,k,temp=0;
	point a,b,c;
	int aa,bb;
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			for(k=j+1;k<=n;k++)
			{
				temp=0;
				a=p[i]-p[k];
				b=p[j]-p[k];
				aa=val[i][k];
				bb=val[i][j]+val[j][k]-val[j][j];
				if((a^b)>0)
				{
					temp=aa-bb;
					temp+=2;
				}
				else
				{
					temp=bb-aa;
					temp+=3;
				}
				if(temp>ans1)ans1=temp;
			}
		}
	}
	for(i=1;i<=n;i++)
	{
		for(j=i+1;j<=n;j++)
		{
			for(k=j+1;k<=n;k++)
			{
				temp=0;
				a=p[i]-p[k];
				b=p[j]-p[k];
				aa=val[i][k];
				bb=val[i][j]+val[j][k]-val[j][j];
				if((a^b)>0)
				{
					temp=aa-bb;
					temp+=2;
				}
				else
				{
					temp=bb-aa;
					temp+=3;
				}
				if(temp==ans1)ans2++;
			}
		}
	}
	out<<ans1<<' '<<ans2<<endl;
}
bool com(point a,point b)
{
	return a.x<b.x;
}
int main()
{
	int i;
	in>>n;
	for(i=1;i<=n;i++)in>>p[i].x>>p[i].y;
	sort(p+1,p+n+1,com);
	work();
	MMORPG();
	return 0;
}