_lxm @ 2024-09-17 19:24:22
记录
#include<bits/stdc++.h>
using namespace std;
struct node{
double x,y;
} a[200005];
int n;
double ans=0x3f3f3f3f;
bool cmp(node a,node b){
if(a.x==b.x) return a.y<b.y;
return a.x<b.x;
}
int main(){
cin >>n;
for(int i=1;i<=n;i++){
cin >>a[i].x >>a[i].y;
}
sort(a+1,a+1+n,cmp);
for(int i=1;i<=n-1;i++){
for(int j=i+1;j<=i+3;j++){
double k=sqrt(pow(abs(a[i].x-a[j].x),2)+pow(abs(a[i].y-a[j].y),2));
ans=min(ans,k);
}
}
cout <<fixed <<setprecision(4) <<ans;
return 0;
}
by mediocre_ @ 2024-09-22 09:05:05
@_lxm 你不开 O2 能过?
by _lxm @ 2024-09-22 09:06:38
可以
by _lxm @ 2024-09-22 09:07:29
实力 @mediocre_
by _lxm @ 2024-09-22 09:08:28
原因应该是排序时离
by _lxm @ 2024-09-22 09:34:14
@mediocre_ 加强加强版TLEx0
by _lxm @ 2024-09-22 09:35:23
for(int j=i+1;j<=i+3;j++)
把
不过