|
|
back to boardWA on #test 1 /****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int main() { int N,a[55],b[55],i,c[55],j,d[55],e[55],m,n; unsigned long long x,y,arr[55]; cin>>N; for(i=0;i<N;i++){ cin>>a[i]>>b[i]>>c[i]>>d[i]; e[i]=i; } cin>>m>>n; for(i=0;i<N;i++){ x=max(a[i]-m,m-c[i]); if(x<0){ x=0; } y=max(b[i]-n,n-d[i]); if(y<0){ y=0; } arr[i]=x*x+y*y; } for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(arr[i]>a[j]){ arr[i]=arr[j]; e[i]=e[j]; } } } for(i=0;i<N;i++){ cout<<e[i]+1<<endl; } return 0; } |
|
|