CCF 202009-1 称检测点查询

#include
#define TLE ios::sync_with_stdio(0),cin.tie(0)
#define long long ll
const int INF = 0x3f3f3f3f;
const int maxn = 1005;
using namespace std;
struct Node{
     
	int d,id;
}node[maxn];
bool cmp(Node a,Node b){
     
	if(a.d == b.d) return a.id<b.id;
	else return a.d<b.d;
}
int main(){
     
	TLE;
	int n,x,y,X,Y;
	cin>>n>>X>>Y;
	for(int i = 1;i<=n;i++){
     
		cin>>x>>y;
		node[i].d = (x-X)*(x-X)+(y-Y)*(y-Y);
		node[i].id = i;
	}
	sort(node+1,node+1+n,cmp);
	for(int i = 1;i<=3;i++) 
		cout<<node[i].id<<endl;
} 

你可能感兴趣的:(CCF,CSP,ACM)