题目描述

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≤i≤N)
If i≠j, xi≠xj or yi≠yj.
xi and yi are integers.

输入

The input is given from Standard Input in the following format:
N
x1 y1
x2 y2
:
xN yN

输出

Print the sum of all the scores modulo 998244353.

样例输入

4
0 0
0 1
1 0
1 1

样例输出

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.

题意:
平面上有n(n<=)个点,对于其中能够构成凸多边形的点集S,计算一个得分score,并输出所有这样能构成凸多边形的点集的得分之和。
score=^(n-|S|), n: 构成此凸多边形的点数及其内部的点数总和;|S|: 构成此凸多边形的点数。 那么就是要对所有的凸包,求其内部的点数所构成的集合个数。
发现太难求了,总不能枚举所有的凸包啊……
所以我们就从反面来求,求所有点构成的集合个数-不能构成凸包的集合个数
什么样的点不能构成集合? 单点或共线
所以就枚举所有直线就好了
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=;
const int p=;
int n;
struct orz{
int x,y;}a[N];
ll ans;
ll poww(ll x,ll y)
{
ll ret=;
while(y)
{
if (y&) ret=ret*x%p;
x=x*x%p;
y>>=;
}
return ret;
}
bool check(int a,int b,int c,int d)
{
if (a*d==b*c) return ;
else return ;
}
void solve()
{
for (int i=;i<=n;i++)
{
for (int j=i+;j<=n;j++)
{
int cnt=;
for (int k=j+;k<=n;k++)
if (check(a[i].x-a[j].x,a[j].x-a[k].x,a[i].y-a[j].y,a[j].y-a[k].y)) cnt++;
ans=(ans-poww(,cnt)+p)%p; }
}
}
int main()
{
scanf("%d",&n);
for (int i=;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
ans=poww(,n);
ans=(ans--n+p)%p; solve();
printf("%lld\n",ans%p);
return ;
}

ConvexScore的更多相关文章

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

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

  2. 【ARC082E】ConvexScore

    Description 给定二维直角坐标系上的N个点\((X_i,Y_i)\),定义一个有N个点中的部分点所构成点集为"凸点集",当且仅当该集合内的所有点恰好构成一个面积为正的凸多 ...

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

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

  4. 【Atcoder】ARC082 E - ConvexScore

    [算法]计算几何 [题意]给定平面直角坐标系上的若干个点,任意选点连成凸多边形,凸多边形的价值定义为2^(n-|S|),其中n为凸多边形内部点数(含边界),|S|为顶点数,求总价值.n<=10^ ...

  5. AtCoder ARC 082E - ConvexScore

    传送门:http://arc082.contest.atcoder.jp/tasks/arc082_c 本题是一个平面几何问题. 在平面直角坐标系中有一个n元点集U={Ai(xi,yi)|1≤i≤n} ...

  6. [arc082e]ConvexScore

    题意: 给出直角坐标系中的$N$个点$(X_i,Y_i)$,定义由其中部分点构成的点集为“凸点集”当且仅当这些点恰好能构成一个凸多边形(内部没有其他点). 如图,点集$\{A,C,E\}$和$\{B, ...

  7. ARC082E ConvexScore(神奇思路)

    这题就是拼拼凑凑就出来了. 可能看英文题面容易题意杀(小写大写 \(n,N\)),这里复述一遍:对于每个构成凸多边形的点集(每个点恰好都是凸多边形的顶点,必须是严格的凸多边形,内角严格小于 180 度 ...

  8. AtCoder Regular Contest 082

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

  9. 【AtCoder】ARC082

    C - Together 用一个数组记一下一个数给它本身,左右贡献都是1,看看哪个数的总贡献最大 #include <bits/stdc++.h> #define fi first #de ...

随机推荐

  1. 1.linux环境配置

    首先说一下,这里是虚拟机环境. 1.用vbox安装centos6.8-mini 注意不要使用复制的方式安装,复制的虚拟机网络不通 安装如下: 主机 ip 角色 内存 hadoop1 192.168.0 ...

  2. Python中的__future__

    在Python中,你如果在某一个版本的Python想使用未来版本中的功能,可以使用如下语法实现: from __future__ import futurename 这条语句必须放在module文件的 ...

  3. 《剑指Offer》题二十一~题三十

    二十一.调整数组顺序使奇数位于偶数前面 题目:输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所有偶数位于数组的后半部分. 测试用例: 功能测试:输入数组中的奇 ...

  4. Swift-闭包理解

    /* 闭包(Closures) * 闭包是自包含的功能代码块,可以在代码中使用或者用来作为参数传值. * 在Swift中的闭包与C.OC中的blocks和其它编程语言(如Python)中的lambda ...

  5. Ubuntu启用root账号登录系统

    使用root账号登陆Ubuntu系统,实现起来本身没啥难度,运行passwd root即可,然后在/etc/ssh/sshd_config里面修改PermitRootLogin yes即可.不过研究的 ...

  6. 第一部分shell编程1基础知识

    ls etc/init.d/ shell脚本的路径 ls /usr/local/apache2/ ls /usr/local/apache2/bin/apachectl 1. shell特性命令历史 ...

  7. Python文件操作大全,随机删除文件夹内的任意文件

     在读文件的时候往往需要遍历文件夹,python的os.path包含了很多文件.文件夹操作的方法: os.path.abspath(path) #返回绝对路径os.path.basename(path ...

  8. c++读取文件夹及子文件夹数据

    这里有两种情况:读取文件夹下所有嵌套的子文件夹里的所有文件  和 读取文件夹下的指定子文件夹(或所有子文件夹里指定的文件名) <ps,里面和file文件有关的结构体类型和方法在 <io.h ...

  9. 限制玻尔兹曼机(Restricted Boltzmann Machine)RBM

    假设有一个二部图,每一层的节点之间没有连接,一层是可视层,即输入数据是(v),一层是隐藏层(h),如果假设所有的节点都是随机二值变量节点(只能取0或者1值)同时假设全概率分布满足Boltzmann 分 ...

  10. UIKit中的几个核心对象的介绍:UIApplication,UIWindow,UIViewController,UIView(layer)简单介绍

    UIApplication,UIWindow,UIViewController,UIView(layer)简单介绍 一:UIApplication:单例(关于单例后面的文章中会详细介绍,你现在只要知道 ...