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
|
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 210;
int n, X, Y;
struct Point
{
int x, y, d;
int id;
bool operator< (const Point& t) const
{
if (d != t.d) return d < t.d;
return id < t.id;
}
}q[N];
int get_dist(int x1, int y1, int x2, int y2)
{
int dx = x1 - x2;
int dy = y1 - y2;
return dx * dx + dy * dy;
}
int main()
{
cin >> n >> X >> Y;
for (int i = 0; i < n; i ++ )
{
int x, y;
cin >> x >> y;
q[i] = {x, y, get_dist(X, Y, x, y), i + 1};
}
sort(q, q + n);
for (int i = 0; i < 3; i ++ ) cout << q[i].id << endl;
return 0;
}
|