去掉快读试试
by lytqwq @ 2019-08-03 21:32:04
@[liyuting_233](/space/show?uid=104319) 尝试过用scanf代替快读,但没用
by wudiss8 @ 2019-08-03 21:34:23
另外附上代码
```cpp
#include<bits/stdc++.h>
using namespace std;
struct edge{
double x,y,z;
}a[10000001];
int s,p,tot,fat[501],poi[501][2];
double ans;
bool cmp(edge awa,edge qwq){
return awa.z<qwq.z;
}
int getfat(int x){
if(fat[x]==x)return x;
fat[x]=getfat(fat[x]);
return fat[x];
}
bool kruskal(){
int f1,f2,k,i;
for(i=1;i<=p;i++)fat[i]=i;
for(i=1;i<=tot;i++){
f1=getfat(a[i].x);
f2=getfat(a[i].y);
if(f1!=f2){
ans=max(ans,a[i].z);
k++;
fat[f2]=f1;
if(k==p-s)return true;
}
}
if(k<p-s){
printf("Impossible\n");
return false;
}
}
inline int read(){
char c=getchar();
int s=1,f=0;
while(c<'0' or c>'9'){
if(c=='-')
s=-1;
c=getchar();
}
while(c>='0' and c<='9'){
f=f*10+c-'0';
c=getchar();
}
return s*f;
}
int main(){
int i,j;
s=read();p=read();
for(i=1;i<=p;i++){
scanf("%d%d",&poi[i][0],&poi[i][1]);
for(j=1;j<i;j++){
tot++;
a[tot].x=i;
a[tot].y=j;
a[tot].z=sqrt(((poi[i][0]-poi[j][0])*(poi[i][0]-poi[j][0]))+((poi[i][1]-poi[j][1])*(poi[i][1]-poi[j][1])));
}
}
sort(a+1,a+tot+1,cmp);
if(kruskal())
printf("%.2lf\n",ans);
return 0;
}
```
by wudiss8 @ 2019-08-03 21:35:38
@[wudiss8](/space/show?uid=95072) 是不是精度问题啊?建议用在线IDE检测下
by Raina_xyy @ 2019-08-03 21:37:24
@[Lstdo](/space/show?uid=53930) 第一个数据是样例啊。
by wudiss8 @ 2019-08-03 21:38:21
@[Raina_xyy](/space/show?uid=104225) emmmm,在线IDE是300,怎么回事?
by wudiss8 @ 2019-08-03 21:39:41
@[wudiss8](/space/show?uid=95072)
可能是精度问题
```cpp
printf("%.2lf\n",ans);
```
改成
```cpp
printf("%.2f\n",ans);
```
试试
by Lstdo @ 2019-08-03 21:40:34
@[wudiss8](/space/show?uid=95072) 把poi的类型改为double看下,Linux系统下和windows下总有些奇怪的差别
by Raina_xyy @ 2019-08-03 21:40:52
@[Lstdo](/space/show?uid=53930) 没有用。
by wudiss8 @ 2019-08-03 21:42:04
@[Lstdo](/space/show?uid=53930) double 就是 lf 鸭 qwq
by Raina_xyy @ 2019-08-03 21:42:24