-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp.cpp
More file actions
63 lines (61 loc) · 1.19 KB
/
p.cpp
File metadata and controls
63 lines (61 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <bits/stdc++.h>
using namespace std;
long long dotProduct(vector <long long> a,vector <long long> b,vector <long long> c)
{
long long ans=0;
for(int i=0;i<5;i++)
ans+=(b[i]-a[i])*(c[i]-a[i]);
return ans;
}
int main()
{
long long n,i,j,k;
scanf("%lld",&n);
if(n==1)
{
printf("1\n1");
return 0;
}
if(n==2)
{
printf("2\n1\n2");
return 0;
}
vector <long long> point[n];
for(i=0;i<n;i++)
{
long long temp;
for(j=0;j<5;j++)
{
scanf("%lld",&temp);
point[i].push_back(temp);
}
}
bool foundGood=false;
for(i=0;i<n;i++)
{
bool isGood=true;
for(j=0;j<n;j++)
{
for(k=0;k<n;k++)
{
if(i!=j && j!=k && k!=i && dotProduct(point[i],point[j],point[k])>0)
{
isGood=false;
break;
}
}
if(!isGood)
break;
}
if(isGood)
{
foundGood=true;
break;
}
}
if(foundGood)
printf("1\n%d",i+1);
else
printf("0");
}