File tree 1 file changed +47
-0
lines changed
1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+ typedef pair<int , int > pii;
5
+ #define mp (a, b ) make_pair(a, b)
6
+ #define X first
7
+ #define Y second
8
+
9
+ #define FOR (i, a, b ) for (int i = a; i < b; i++)
10
+
11
+ // find the point which minimizes the maximum distance to other points.
12
+
13
+ int N;
14
+ vector<pii> pts;
15
+
16
+ int dist (pii a, pii b){
17
+ return (a.X -b.X )*(a.X -b.X ) + (a.Y -b.Y )*(a.Y -b.Y );
18
+ }
19
+
20
+ int main () {
21
+ ios::sync_with_stdio (false ); cin.tie (NULL );
22
+ cin>>N;
23
+ FOR (i, 0 , N){
24
+ int a, b;
25
+ cin>>a>>b;
26
+ pts.push_back (mp (a, b));
27
+ }
28
+
29
+ int d=2000000000 ;
30
+ pii ans;
31
+
32
+ FOR (i, 0 , N){
33
+ int dd=0 ;
34
+ FOR (j, 0 , N){
35
+ dd = max (dd, dist (pts[i], pts[j]));
36
+ }
37
+
38
+ if (dd < d) {
39
+ ans = pts[i];
40
+ d = dd;
41
+ }
42
+ }
43
+
44
+ cout<<ans.X <<" " <<ans.Y <<" \n " ;
45
+
46
+ return 0 ;
47
+ }
You can’t perform that action at this time.
0 commit comments