|
|
back to boardRe: AC, no problem ;-) Posted by Junk 10 Aug 2009 17:16 thx for test Re: AC, no problem ;-) my code passed yours test but shows WA1 #include <bits/stdc++.h> using namespace std; int main() { int N,a[55],b[55],i,c[55],j,d[55],t,e[55],m,n; unsigned long long x,y,p,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]){ p=arr[i]; arr[i]=arr[j]; arr[j]=p; t=e[i]; e[i]=e[j]; e[j]=t; } } } for(i=0;i<N;i++){ cout<<e[i]+1<<" "; } return 0; } |
|
|