提交记录 20281
提交时间 |
评测时间 |
2023-10-10 23:32:12 |
2023-10-10 23:32:17 |
#include<bits/stdc++.h>
using namespace std;
int t;
int n,h,r;
int x[1001],y[1001],z[1001];
int a[1001];
int s[1001],e[1001];
int ls,le;
int find(int x){
if(x==a[x]){
return x;
}else{
return (a[x]=find(a[x]));
}
}
double l(int x1,int y1,int z1,int x2,int y2,int z2){
return sqrt( pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2) );
}
void run(){
for(int i=1;i<=ls;i++){
for(int j=1;j<=le;j++){
if(find(s[i])==find(e[j])){
cout << "Yes\n";
return;
}
}
}
cout << "No\n";
return;
}
int main(){
cin >> t;
while(t--){
ls=le=0;
cin >> n >> h >> r;
for(int i=1;i<=n;i++)a[i]=i;
for(int i=1;i<=n;i++){
cin >> x[i] >> y[i] >> z[i];
if(z[i]+r>=h)e[++le]=i;//这个空洞能上去
if(z[i]-r<=0)s[++ls]=i;//可以作为出发点
for(int j=1;j<i;j++){
if(l(x[i],y[i],z[i],x[j],y[j],z[j]) <= 2*r){
a[find(i)]=find(j);
}
}
}
// for(int i=1;i<=n;i++)cout << a[i] << " ";
run();
}
return 0;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 47.38 us | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 51.77 us | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 53.76 us | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 120.77 us | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 10.516 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 20.988 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 41.834 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 37.588 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 43.453 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 43.511 ms | 60 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2025-09-13 14:08:26 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠