【推导】【暴力】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 ...
随机推荐
- 函数getopt()及其参数optind -- (转)
getopt被用来解析命令行选项参数 #include <unistd.h> extern char *optarg; //选项的参数指针 extern int ...
- [NOI2008] [bzoj1061] 志愿者招募
还是一道费用流的题目.话不多说,进入正题. 题意:给定n个点和m种从l到r覆盖一层的费用,求满足所有点的覆盖层数都大等于权值的最小费用 分析:要做到区间修改,看似比较麻烦. 用差分把区间修改变成单点修 ...
- python中的argparse模块
argparse干什么用的? 答:参数设置,比如python demo.py -h 诸如此类的. 开始学习这个模块: parser = argparse.ArgumentParser() #使用这个模 ...
- rabbitmq之队列性能测试及优化方法(六)
前言 下面关注一下rabbitmq实际使用时的性能问题和怎么进行一些优化. 性能测试 针对每个需要生产/消费者与rabbitmq进行通讯的方法进行测试 测试环境 排除网络IO的干扰,采用生产者和消费者 ...
- SIFT四部曲之——高斯滤波
本文为原创作品,未经本人同意,禁止转载 欢迎关注我的博客:http://blog.csdn.net/hit2015spring和http://www.cnblogs.com/xujianqing/ 或 ...
- 网络知识===《图解TCP/IP》学习笔记——网络的构成要素
首先引入网络构成要素图 图片来自<图解TCP/IP--P37> 1.通信媒介与数据链路 计算机之间通过电缆相互连接,电缆可以分为多种,包括双绞线电缆,光纤电缆,同轴电缆,串行电缆等. 图片 ...
- sicily 1046. Plane Spotting
1046. Plane Spotting Time Limit: 1sec Memory Limit:32MB Description Craig is fond of planes. Mak ...
- 【模板】BZOJ 3685: 普通van Emde Boas树——Treap
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3685 据说神犇都是用zkw线段树水过的啊... 我蒟蒻只会写treap,加了fread之后8 ...
- MyEclipse/Eclipse安装插件的几种方式
众所周知MyEclipse是一个很强大的Java IDE,而且它有许多开源免费又好用的插件,这些插件给我们开发过程中带来了许多方便.插件具有针对性,例如,你如果做安卓开发,可能需要一个ADT(Andr ...
- goreplay HTTP-HTTPS流量复制工具
goreplay相比tcpcopy只能复制HTTP和HTTPS的流量 goreplay编译很麻烦,就直接使用编译好的版本 gor_0.10.1_x64.tar.gz 支持centos5,测试的是cen ...