Problem Statement

You are given N points (xi,yi) located on a two-dimensional plane. Consider a subset S of the N points that forms a convex polygon. Here, we say a set of points S forms a convex polygon when there exists a convex polygon with a positive area that has the same set of vertices as S. All the interior angles of the polygon must be strictly less than 180°.

For example, in the figure above, {A,C,E} and {B,D,E} form convex polygons; {A,C,D,E}, {A,B,C,E}, {A,B,C}, {D,E} and {} do not.

For a given set S, let n be the number of the points among the N points that are inside the convex hull of S (including the boundary and vertices). Then, we will define the score of S as 2n−|S|.

Compute the scores of all possible sets S that form convex polygons, and find the sum of all those scores.

However, since the sum can be extremely large, print the sum modulo 998244353.

Constraints

  • 1≤N≤200
  • 0≤xi,yi<104(1≤iN)
  • If ij, xixj or yiyj.
  • xi and yi are integers.

Input

The input is given from Standard Input in the following format:

N
x1 y1
x2 y2
:
xN yN

Output

Print the sum of all the scores modulo 998244353.


Sample Input 1

Copy
4
0 0
0 1
1 0
1 1

Sample Output 1

Copy
5

We have five possible sets as S, four sets that form triangles and one set that forms a square. Each of them has a score of 20=1, so the answer is 5.


Sample Input 2

Copy
5
0 0
0 1
0 2
0 3
1 1

Sample Output 2

Copy
11

We have three "triangles" with a score of 1 each, two "triangles" with a score of 2 each, and one "triangle" with a score of 4. Thus, the answer is 11.


Sample Input 3

Copy
1
3141 2718

Sample Output 3

Copy
0

There are no possible set as S, so the answer is 0.

————————————————————————————————

题意就是求对每个凸多边形,求(2^内部点数)的和 这里我们可以进行一波转换
考虑每个凸多边形,其内部的点每个都可以选择删与不删,得到的方案数就是贡献
而这个转化恰好就等价于不共线的子集数 共线就是子集内所有点在同一直线上
这样之后我们只要用总的子集数减去共线的子集数就好了
枚举直线倾斜角,算包含至少两点的共线子集有几个
倾斜角用枚举两两点得到 然后求gcd使得每个倾角有唯一表达形式
将向量(x,y)转为唯一表示法,然后求个hash
方便sort比较 然后并查集维护 这样复杂度是n^3
当然也可以把斜率离散化从sort换成散列表或者基数排序 然后并查集换成连边,忽略没连到边的点就n^2了

#include<cstdio>
#include<cstring>
#include<algorithm>
const int M=,mod=;
int read(){
int ans=,f=,c=getchar();
while(c<''||c>''){if(c=='-') f=-; c=getchar();}
while(c>=''&&c<=''){ans=ans*+(c-''); c=getchar();}
return ans*f;
}
int n,f[M],sz[M];
int find(int x){while(f[x]!=x) x=f[x]=f[f[x]]; return x;}
int gcd(int x,int y){return y?gcd(y,x%y):x;}
struct pos{int x,y;}q[M];
int cnt;
struct node{
int u,v,w;
bool operator <(const node &x)const{return w<x.w;}
void calc(){
int p=find(u),q=find(v);
if(p!=q) f[q]=p,sz[p]+=sz[q];
}
}e[M*M];
int pw[M],ans;
void prepare(){
pw[]=;
for(int i=;i<=n;i++) pw[i]=(pw[i-]<<)%mod;
}
int main(){
n=read();
prepare(); ans=(pw[n]-n-)%mod;
for(int i=;i<=n;i++) q[i].x=read(),q[i].y=read();
for(int i=;i<=n;i++)
for(int j=;j<i;j++){
int x=q[i].x-q[j].x,y=q[i].y-q[j].y,g=gcd(x,y);
x/=g; y/=g;
if(!x) y=;
if(!y) x=;
if(x<) x=-x,y=-y;
e[++cnt]=(node){i,j,x*+y};
}
std::sort(e+,e++cnt);
for(int i=,j=;i<=cnt;i=j){
for(int k=;k<=n;k++) sz[f[k]=k]=;
while(j<=cnt&&e[j].w==e[i].w) e[j++].calc();
for(int k=;k<=n;k++) if(f[k]==k&&sz[k]>=) ans=(ans-pw[sz[k]]+sz[k]+)%mod;
}printf("%d\n",(ans+mod)%mod);
return ;
}

AtCoder Regular Contest 082 E的更多相关文章

  1. AtCoder Regular Contest 082 D Derangement

    AtCoder Regular Contest 082 D Derangement 与下标相同与下个交换就好了.... Define a sequence of ’o’ and ’x’ of lengt ...

  2. AtCoder Regular Contest 082

    我都出了F了……结果并没有出E……atcoder让我差4分上橙是啥意思啊…… C - Together 题意:把每个数加1或减1或不变求最大众数. #include<cstdio> #in ...

  3. AtCoder Regular Contest 082 (ARC082) E - ConvexScore 计算几何 计数

    原文链接http://www.cnblogs.com/zhouzhendong/p/8934254.html 题目传送门 - ARC082 E 题意 给定二维平面上的$n$个点,定义全集为那$n$个点 ...

  4. 【推导】【模拟】AtCoder Regular Contest 082 F - Sandglass

    题意:有个沙漏,一开始bulb A在上,bulb B在下,A内有a数量的沙子,每一秒会向下掉落1.然后在K个时间点ri,会将沙漏倒置.然后又有m个询问,每次给a一个赋值ai,然后询问你在ti时刻,bu ...

  5. 【计算几何】【推导】【补集转化】AtCoder Regular Contest 082 E - ConvexScore

    题意:平面上给你N个点.对于一个“凸多边形点集”(凸多边形点集被定义为一个其所有点恰好能形成凸多边形的点集)而言,其对答案的贡献是2^(N个点内在该凸多边形点集形成的凸包内的点数 - 该凸多边形点集的 ...

  6. 【推导】AtCoder Regular Contest 082 D - Derangement

    题意:给你一个排列a,每次可以交换相邻的两个数.让你用最少的交换次数使得a[i] != i. 对于两个相邻的a[i]==i的数,那么一次交换必然可以使得它们的a[i]都不等于i. 对于两个相邻的,其中 ...

  7. AtCoder Regular Contest 082 F

    Problem Statement We have a sandglass consisting of two bulbs, bulb A and bulb B. These bulbs contai ...

  8. AtCoder Regular Contest 082 ABCD

    A #include<bits/stdc++.h> using namespace std; ]; int n,m; int main(){ cin>>n>>m; ...

  9. 【AtCoder Regular Contest 082 F】Sandglass

    [链接]点击打开链接 [题意] 你有一个沙漏. 沙漏里面总共有X单位的沙子. 沙漏分A,B上下两个部分. 沙漏从上半部分漏沙子到下半部分. 每个时间单位漏1单位的沙子. 一开始A部分在上面.然后在r1 ...

随机推荐

  1. ORB-SLAM 代码笔记(五)Frame类

    Frame类的成员变量主要包含从摄像头获取的图像的 1. 特征点信息(关键点+描述字) 2. 尺寸不变特征所用金字塔信息,这些都定义在ORBextractor对象中 3. 词袋模型参数,用于跟踪失败情 ...

  2. 剁了xp,醉了win7

    装完win7,安装各种软件完毕,重启,然并卵.  cpu,内存飙升!! svchost.exe这个进程内存发疯了一样往上飙升 从 几十兆  到占用1个多G, 纳尼, 总共物理内存才2G. ╮(╯▽╰) ...

  3. [电子书] 《Android编程兵书》PDF

    Android编程兵书 内容简介: 这是一本Android开发书籍,内容讲解详细,例子丰富,能帮助读者举一反三.在<Android编程兵书>中,每一个知识点的描述都非常详细,并且每一个知识 ...

  4. Linux-OpenSUSE折腾-1(Qt安装,Chrome安装)

    先上图,大蜥蜴还是不错的,偶然看到了大蜥蜴这个系统,我就觉得又可以折腾几天了,先上图 OpenSUSE有一个入门介绍的网站写的相当不错,感兴趣的可以连接过去:https://lug.ustc.edu. ...

  5. Selenium 启动无头浏览器,只有chrome 和 firefox的,没有IE

    使用无头浏览器,可以避免掉不确定的弹出框对脚本稳定性的影响,还能在脚本执行过程中省略掉了css 加载的时间. 以下是Selenium 启动无头浏览器的方法,只有chrome 和 firefox的. p ...

  6. c++知识点总结--函数模板

    通用函数可变参模板 用于处理不限定参数的函数 showall(){//空函数,接口,最后结束递归 } template<typename T,typename... Args> void ...

  7. HDU 4441 Queue Sequence(优先队列+Treap树)(2012 Asia Tianjin Regional Contest)

    Problem Description There's a queue obeying the first in first out rule. Each time you can either pu ...

  8. ASP.NET 概述

    https://msdn.microsoft.com/zh-cn/library/4w3ex9c2(VS.100).aspx ASP.NET 概述 更新:2007 年 11 月 ASP.NET 是一个 ...

  9. Linux的常用目录学习笔记

    首先,先查看一下Linuxi的一级目录结构: ls: /:表示根目录,文件系统的入口,最高一级目录. bin和sbin:命令保存目录,bin是普通用户能,sbin是root用户用的:/bin存放着系统 ...

  10. HL7 2.6 解析(XML)

    用途:检验化验(LIS)实验室设备数据交换解析. using System; using System.Collections.Generic; using System.Text; using Sy ...