【推导】【暴力】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C. Five Dimensional Points
题意:给你五维空间内n个点,问你有多少个点不是坏点。
坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点。
结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个点,就会导致所有点都变成坏点。
容易看出来(?),把2*n+1个点分别放在原点处和每个坐标轴的正负半轴上各一个比较优。
所以n>11时,直接输出零,否则暴力枚举。
#include<cstdio>
using namespace std;
typedef long long ll;
struct Point{
ll v,w,x,y,z;
Point(const ll &v,const ll &w,const ll &x,const ll &y,const ll &z){
this->v=v;
this->w=w;
this->x=x;
this->y=y;
this->z=z;
}
Point(){}
void read(){
scanf("%I64d%I64d%I64d%I64d%I64d",&v,&w,&x,&y,&z);
}
}p[1011];
typedef Point Vector;
Vector operator - (const Point &a,const Point &b){
return Vector(a.v-b.v,a.w-b.w,a.x-b.x,a.y-b.y,a.z-b.z);
}
ll dot(const Vector &a,const Vector &b){
return a.x*b.x+a.y*b.y+a.z*b.z+a.v*b.v+a.w*b.w;
}
int n,e,anss[1011];
int main(){
// freopen("c.in","r",stdin);
scanf("%d",&n);
if(n>11){
puts("0");
return 0;
}
for(int i=1;i<=n;++i){
p[i].read();
}
for(int i=1;i<=n;++i){
bool flag=1;
for(int j=1;j<=n;++j){
bool f2=1;
for(int k=1;k<=n;++k){
if(i!=j && j!=k){
if(dot(p[j]-p[i],p[k]-p[i])>0){
f2=0;
break;
}
}
}
if(!f2){
flag=0;
break;
}
}
if(flag){
anss[++e]=i;
}
}
printf("%d\n",e);
if(e){
for(int i=1;i<e;++i){
printf("%d ",anss[i]);
}
printf("%d\n",anss[e]);
}
return 0;
}
【推导】【暴力】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C. Five Dimensional Points的更多相关文章
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)ABCD
A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megaby ...
- 【推导】Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B. Arpa and an exam about geometry
题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置. 只要A,B,C构成等腰三角形,且B为上顶点.那么其外接圆圆心即 ...
- Codeforces Round #432 (Div. 1, based on IndiaHacks Final Round 2017) D. Tournament Construction(dp + 构造)
题意 一个竞赛图的度数集合是由该竞赛图中每个点的出度所构成的集合. 现给定一个 \(m\) 个元素的集合,第 \(i\) 个元素是 \(a_i\) .(此处集合已经去重) 判断其是否是一个竞赛图的度数 ...
- D. Arpa and a list of numbers Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)
http://codeforces.com/contest/851/problem/D 分区间操作 #include <cstdio> #include <cstdlib> # ...
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) C
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two poi ...
- 【前缀和】【枚举倍数】 Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D. Arpa and a list of numbers
题意:给你n个数,一次操作可以选一个数delete,代价为x:或者选一个数+1,代价y.你可以进行这两种操作任意次,让你在最小的代价下,使得所有数的GCD不为1(如果全删光也视作合法). 我们从1到m ...
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) D
Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and g ...
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) B
Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a, ...
- Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017) A
Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. Th ...
随机推荐
- recycleView实现item点击更改该item颜色,其它item颜色变回
项目中需要横向滚动效果,按照以前的思路,我会写一个ScrollView,里边加一个LinearLayout,在代码中动态加入控件,然后动态删除或者改变颜色,现在android有了新控件Recycler ...
- ms17-010 攻击win7漏洞复现
只是为了好玩重新写一篇.利用还是很简单的. 将下载下来的rb放置在:/usr/share/metasploit-framework/modules/exploits/windows/smb/ 目录下 ...
- centos_7.1.1503_src_3
http://vault.centos.org/7.1.1503/os/Source/SPackages/ kdf-4.10.5-3.el7.src.rpm 05-Jul-2014 13:28 161 ...
- C基础 多用户分级日志库 sclog
引言 - sclog 总的设计思路 sclog在之前已经内置到simplec 简易c开发框架中一个日志库. 最近对其重新设计了一下. 减少了对外暴露的接口. 也是C开发中一个轮子. 比较简单, 非常适 ...
- Canvas开发库封装
一.Canvas第三方类库 1.常见的第三方类库 konva.js <style> body{ margin:0; } </style> </head> <b ...
- ACE_Reactor类
.ACE反应器框架简介 反应器(Reactor):用于事件多路分离和分派的体系结构模式 对一个文件描述符指定的文件或设备的操作, 有两种工作方式: 阻塞与非阻塞. 在设计服务端程序时,如果采用阻塞模式 ...
- Git——Git常用命令速查表
- CCF试题:高速公路(Targin)
问题描述 某国有n个城市,为了使得城市间的交通更便利,该国国王打算在城市之间修一些高速公路,由于经费限制,国王打算第一阶段先在部分城市之间修一些单向的高速公路. 现在,大臣们帮国王拟了一个修高速公路的 ...
- Linux磁盘的性能详细测试办法
# 测试写入20Gb文件sync && time -p bash -c "(dd if=/dev/zero of=test.dd bs=1000K count=20000; ...
- Centos7Yum安装配置指定版本nginx
1.安装 rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm 2.启 ...