提交记录 20281


用户 题目 状态 得分 用时 内存 语言 代码长度
wangif424 noip17d. 【NOIP2017】奶酪 Accepted 100 43.511 ms 60 KB C++17 918 B
提交时间 评测时间
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;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #147.38 us60 KBAcceptedScore: 10

Testcase #251.77 us60 KBAcceptedScore: 10

Testcase #353.76 us60 KBAcceptedScore: 10

Testcase #4120.77 us60 KBAcceptedScore: 10

Testcase #510.516 ms60 KBAcceptedScore: 10

Testcase #620.988 ms60 KBAcceptedScore: 10

Testcase #741.834 ms60 KBAcceptedScore: 10

Testcase #837.588 ms60 KBAcceptedScore: 10

Testcase #943.453 ms60 KBAcceptedScore: 10

Testcase #1043.511 ms60 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2025-09-13 14:08:26 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠