#include #include #define DN 10050 int N, K, bx, by, i, x, y; typedef struct { int x, y; }point; point pct[DN]; int cmp (const void * a, const void * b) { const point *p1=(const point*)a; const point *p2=(const point*)b; int d1= ((*p1).x-bx) * ((*p1).x-bx) + ((*p1).y-by) * ((*p1).y-by); int d2= ((*p2).x-bx) * ((*p2).x-bx) + ((*p2).y-by) * ((*p2).y-by); if (d1==d2){ if ((*p1).x == (*p2).x) return (*p1).y - (*p2).y; return (*p1).x - (*p2).x; } return d1 - d2; } int main() { scanf ("%d %d %d %d", &N, &K, &bx, &by); for (i=0; i