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. Log4net的一个小例子

    最近想学习下log4net,写了个很简短的使用例子.用少的代码,可以保证程序运行起来. 配置文件: <configSections> <section name="log4 ...

  2. Python学习笔记(二)一一一字典总结

    创建方式:1 直接创建     newDictonary={‘key’:'value',} 2 列表转字典(dict函数) 3 基本操作:len 返回总数 dictionary[k]  返回k对应的值 ...

  3. lua优化

    前言 Lua是一门以其性能著称的脚本语言,被广泛应用在很多方面,尤其是游戏.像<魔兽世界>的插件,手机游戏<大掌门><神曲><迷失之地>等都是用Lua来 ...

  4. 为DEV C++/CodeBlock配置gdb调试遇到的问题

    DEV C++和CodeBlock都只是一个IDE,不能编译调试,需要自己配置MINGW和gdb调试 1.MINGW 在这下载mingw-get-setup.exe安装即可. https://sour ...

  5. 【EasyNetQ】- 连接RabbitMQ

    如果您习惯于处理与SQL Server等关系数据库的连接,那么您可能会发现EasyNetQ处理连接的方式有点奇怪.与关系数据库的通信始终由客户端启动.客户端打开连接,发出SQL命令,在必要时处理结果, ...

  6. Dubbo 的 Helloworld

    前提条件 安装好了 ZooKeeper 作为注册中心 服务端 <?xml version="1.0" encoding="UTF-8"?> < ...

  7. request.getParameterMap() 获取表单提交的键值对 并且 也能获取动态表单的key

    Map<String,String[]> map = request.getParameterMap();Set<String> keys = map.keySet(); 获取 ...

  8. BZOJ3522 POI2014HOT-Hotels(树形dp)

    分两种情况.三点两两lca相同:在三点的lca处对其统计即可,显然其离lca距离应相同:某点在另两点lca的子树外部:对每个点统计出与其距离x的点有多少个即可. 可以长链剖分做到线性,当然不会. #i ...

  9. arc073 F many moves(dp + 线段树)

    设dp[i][y]表示一个点在x[i],另一个点在y时最小要走的步数 那么有以下转移 对于y != x[i-1]的状态,可以证明,他们直接加|x[i] - x[i-1]|即可(如果有其他方案,不符合对 ...

  10. [UVA1402]Robotic Sort;[SP2059]CERC07S - Robotic Sort([洛谷P3165][CQOI2014]排序机械臂;[洛谷P4402][Cerc2007]robotic sort 机械排序)

    题目大意:一串数字,使用如下方式排序: 先找到最小的数的位置$P_1$,将区间$[1,P_1]$反转,再找到第二小的数的位置$P_2$,将区间$[2,P_2]$反转,知道排序完成.输出每次操作的$P_ ...