【推导】【暴力】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 ...
随机推荐
- 【HNOI】d 最小割
[题目大意]给定一个n*m的土地,每块可以种a或b作物,每种作物在不同的位置有不同的收成,同时,有q个子矩阵中,全部种指定的作物(a或b)会有一定的加成收成,求最大收成. [数据范围] 50% n,m ...
- End to End Sequence Labeling via Bidirectional LSTM-CNNs-CRF论文小结
本篇论文是卡内基梅隆大学语言技术研究所2016年 arXiv:1603.01354v5 [cs.LG] 29 May 2016 今天先理解一下这个是什么意思: 找到的相关理解:arXi ...
- Python学习笔记 - day8 - 异常
异常 在程序运行过程中,总会遇到各种各样的错误.有的错误是程序编写有问题造成的,比如本来应该输出整数结果输出了字符串,有的错误是用户输入造成的,比如让用户输入email地址,结果得到一个空字符串,这种 ...
- 日常开发技巧:在远程机器上直接使用adb
背景 嵌入式开发中,开发工作是在远程服务器上进行的.当需要adb推送一个文件到开发板时,则需要重新在本地机器中找到该文件,再执行命令.这样的操作比较麻烦. 下面介绍我的解决方式. sshfs挂载 首先 ...
- FreeRADIUS + MySQL 安装配置笔记
FreeRADIUS + MySQL 安装配置笔记 https://www.2cto.com/net/201110/106597.html
- C# 读写XML文件示例
using System; using System.Collections.Generic; using System.Text; using System.Configuration; using ...
- 使用OC swift 截取路径中的最后的文件名
使用 OC swift 截取路径中的最后的文件名 如何截取下面路径中最后的文件名 AppDelegate.swift /Users/XXX/Desktop/Swift/swift02/code/02- ...
- [How to]集成SQLite3
1.简介 本文将介绍IOS的开发过程中如何集成Sqlite的方法,目前Sqlite的版本为3,所以我们称之为Sqlite3. 在本文中我将介绍Sqlite3的开发配置,本地Sqlite3数据库的建立通 ...
- Django Ajax学习二之文件上传
基于Django实现文件上传 1. url路由配置 路径:C:\Users\supery\Desktop\day82\demo_ajax\demo_ajax\urls.py from django.c ...
- [loj#2566][BZOJ5333] [Sdoi2018]荣誉称号 树形dp
#2566. 「SDOI2018」荣誉称号 休闲游戏玩家小 Q 不仅在算法竞赛方面取得了优异的成绩,还在一款收集钻石的游戏中排名很高. 这款游戏一共有 n 种不同类别的钻石,编号依次为 1 到 n ...