Description
给n个平面上的点。定义一个点的集合S的权值为2|S|-|T|,其中T是集合S在凸包上的点
求所有点的集合的权值之和
Solution
看不懂题是最大的阻碍。。
那个|S|-|T|实际上就是凸包内部的点,那么S权值的含义就是那些点集的凸包和S的凸包相同
于是问题就变成了可以任意选点,问组成凸包的数量。这个我们减去单点和直线的情况算答案就可以了
Code
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
typedef long long LL;
const int MOD=998244353;
const int N=200005;
struct pos {int x,y;} p[N];
pos operator -(pos a,pos b) {
return (pos) {a.x-b.x,a.y-b.y};
}
int operator *(pos a,pos b) {
return a.x*b.y-b.x*a.y;
}
LL bin[N];
int read() {
int x=0,v=1; char ch=getchar();
for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):v,ch=getchar());
for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
return x*v;
}
bool line(pos a,pos b,pos c) {
return (a-b)*(c-b)==0;
}
int main(void) {
bin[0]=1; rep(i,1,N-1) bin[i]=bin[i-1]*2LL%MOD;
int n=read();
rep(i,1,n) p[i].x=read(),p[i].y=read();
LL ans=bin[n]-n-1-(n-1)*n/2; ans=(ans%MOD+MOD)%MOD;
rep(i,1,n) rep(j,i+1,n) {
int s=0;
rep(k,j+1,n) {
s+=line(p[i],p[j],p[k]);
}
ans=(ans+MOD-bin[s]+1)%MOD;
}
printf("%lld\n", ans);
return 0;
}