【推导】【暴力】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 ...
随机推荐
- vue 表格阻止父元素冒泡事件
思路如下:1.给复选框定义一个类型,type="selection" 2.在点击函数中就可以使用判断条件来进行复选框的阻止冒泡.rowDetailShow(row, event, ...
- javascript中null与undefined的区别
1.null null是一个对象,表示一个空对象指针,typeof(null)返回object,null参与运算时会转化为0,将对象初始化为null,可以知道变量是否保存了对象的引用 2.undefi ...
- 报错注入遇到ERROR 1242 (21000): Subquery returns more than 1 row解决方案
我的SQL语句是这样写的. mysql> select 1,2,3 and updatexml(1,concat(1,(select user from mysql.user),1),1);ER ...
- python中requests库中文乱码问题
当使用这个库的时候经常会出现各种乱码的情况. 首先要知道: text返回的是处理过的unicode的数据. content返回的是bytes的原始数据 也就是说r.content比r.text更加节省 ...
- ubuntu下定时弹窗记录工作日志
背景 记录工作日志,是一个很好的习惯,但不容易坚持,本来打算每天记录,但经常拖延,拖着拖着,有一些事情就忘记了. 等到写周报或月报的时候,才会开始翻邮件,聊天记录,各个仓库的提交log等,回忆都干了些 ...
- Makefile系列之四 :条件判断
一.示例 下面的例子,判断$(CC)变量是否“gcc”,如果是的话,则使用GNU函数编译目标. libs_for_gcc = -lgnu normal_libs = foo: $(objects) i ...
- Python——format()/str.format()函数
格式化输出,除了类似于C语言的格式化输出外,还有str.format()方法,Python内建的format()函数,允许用户将待输出值以参数的形式,调用format()函数,在Python交互式sh ...
- socket实现udp与tcp通信-java
1.简单介绍Socket Socket套接字 网络上具有唯一标识的IP地址和端口号组合在一起才能构成唯一能识别的标识符套接字. 通信的两端都有Socket. 网络通信其实就是Socket间的通信. 数 ...
- HDU - 2818
Building Block Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- cvs 日常使用
http://www.51testing.com/html/44/17144-2954.html http://www.chedong.com/tech/cvs_card.html