@[YuRuochen](/user/658786) 请详细说明 Waiting 和时间复杂度的关系。
xswl
by Failure_Creator @ 2022-08-30 13:41:04
poj上超时????
by YuRuochen @ 2022-08-30 13:44:46
```
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,d,x,y,t;
struct line{
double s,e;
} ls[1010];
bool cmp(line a,line b){
return a.s<b.s;
}
int main(){
while(~scanf("%d%d",&n,&d)&&n&&d){
t++;
bool flag=1;
for(int i=1;i<=n;i++){
scanf("%d%d",&x,&y);
if(y>d){
flag=0;
break;
}
double p=sqrt(d*d-y*y);
ls[i].s=x-p;
ls[i].e=x+p;
}
if(!flag){
printf("Case %d: -1\n",t);
continue;
}
sort(ls+1,ls+n+1,cmp);
int cnt=0;
double now=-1e9;
for(int i=1;i<=n;i++){
if(ls[i].s>now){
cnt++;
now=ls[i].e;
}else if(ls[i].e<now) now=ls[i].e;
}
printf("Case %d: %d\n",t,cnt);
}
return 0;
}
by YuRuochen @ 2022-08-30 13:45:33
@[YuRuochen](/user/658786) waiting 和时间有没有关系只能说明这段时间uva交不上去
by xfrvq @ 2022-08-30 13:50:24
@[OneZzz6174](/user/368107) TLE呢?(poj)
by YuRuochen @ 2022-08-30 13:55:05
@[YuRuochen](/user/658786)
waiting 说明 RMJ / UVa 炸了
时间超了是 TLE
by LeTu_Jun @ 2022-08-30 13:58:56
@[LeTu_Jun](/user/474235) 时间复杂度O(nlogn)完全没问题啊!
by YuRuochen @ 2022-08-30 14:05:40
@[YuRuochen](/user/658786) 我看着像是 O(n^2logn)
by LeTu_Jun @ 2022-08-30 14:11:42
@[YuRuochen](/user/658786) 你为什么还在时间复杂度上面纠结
by Feng_Jing @ 2022-08-30 14:24:31
@[LeTu_Jun](/user/474235) ?
by YuRuochen @ 2022-08-30 14:42:42