蒟蒻第二个点TLEqwq,求助dalao

P1257 平面上的最接近点对

@[daonan](/user/547513) 用双重循环真的会爆我不骗你 ~~给我一点时间修改正解~~
by shaoziqi @ 2022-01-30 10:50:52


AC : ```cpp #include<bits/stdc++.h> using namespace std; #ifdef ONLINE_JUDGE static char buf[1000001],*p1=buf,*p2=buf; #define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++ #endif inline int read() { char ch=getchar(); long long f=1,res=0; while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') res=(res<<1)+(res<<3)+ch-48,ch=getchar(); return res*f; } struct node { int x=0; int y=0; }ex[10005]; int main(){ int n=0; double num = 1919810; n=read(); for(int i = 1;i <= n;i++) { ex[i].x=read(),ex[i].y=read(); for(int j = i-1;j>0;j--) { int x = (ex[i].x - ex[j].x)*(ex[i].x - ex[j].x); int y = (ex[i].y - ex[j].y)*(ex[i].y - ex[j].y); if(sqrt(x+y)<num) num=sqrt(x+y); } } printf("%.4f",num); } ```
by shaoziqi @ 2022-01-30 10:58:49


@[shaoziqi](/user/562804) 确实用快读就能过了qwq,谢谢大佬!
by daonan @ 2022-01-30 11:44:17


|