【推导】【暴力】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 ...
随机推荐
- python中的Queue模块
queue介绍 queue是python的标准库,俗称队列.可以直接import引用,在python2.x中,模块名为Queue.python3直接queue即可 在python中,多个线程之间的数据 ...
- python实战===一键刷屏
#当按键q的时候,自动输入 “大家好!”并回车键发送!from pynput import keyboard from pynput.keyboard import Key, Controller k ...
- linux dpm机制分析(上)【转】
转自:http://blog.csdn.net/lixiaojie1012/article/details/23707681 1 DPM介绍 1.1 Dpm: 设备电源管理, ...
- 64_l5
libsmartcols-2.29.1-2.fc26.x86_64.rpm 13-Feb-2017 07:04 150590 libsmartcols-devel-2.29.1-2.fc26.i686 ...
- GitHub创建项目入门学习
第一次创建git项目注意事项还是挺多了,这里就写个操作步骤,方便以后查看. 网页部分 1.打开自己的主页,点击“New repository”创建远程仓库. 2.填写信息 本地部分 前提: 下载git ...
- C#利用WinRAR实现压缩和解压缩
using System; using Microsoft.Win32; using System.Diagnostics; using System.IO; namespace MSCL { /// ...
- idea+spring+springmvc+mybatis+mybatis+maven
使用SSM(Spring,SpringMVC和Mybatis) 1.1.Spring Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johns ...
- leetcode 之Gas Station(11)
这题的思路很巧妙,用两个变量,一个变量衡量当前指针是否有效,一个衡量整个数组是否有解,需要好好体会. int gasStation(vector<int> &gas, vector ...
- 883H - Palindromic Cut(思维+STL)
题目链接:http://codeforces.com/problemset/problem/883/H 题目大意:给一段长度为n的字符串s,想让你把s切成几段长度相同的回文串,可以改变s中字符的排列, ...
- Bootstrap Div 居中的方法
有两个DIV,DIV2被包含在DIV1中.格式如下: <div id="div1"> <div id="div2"> & ...