提交记录 9792


用户 题目 状态 得分 用时 内存 语言 代码长度
labtree noip17d. 【NOIP2017】奶酪 Accepted 100 61.493 ms 3976 KB C++ 834 B
提交时间 评测时间
2019-07-14 09:34:59 2020-08-01 01:51:35
#include<bits/stdc++.h>
using namespace std;
long long t,n,r,h;
long long vis[500001];
bool pd;
struct hole{
    double x,y,z;
}q[50001];
bool check_dist(hole a,hole b) {
    long long dis=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)+(a.z-b.z)*(a.z-b.z);
    if(dis<=4*r*r) 
		return true;
    else 
		return false;
}
void dfs(int k){
    if(pd||q[k].z+r>=h){
    	pd=1;
    	return;
	}
	for(int i=1;i<=n;i++){
		if(vis[i])
			continue;
		if(check_dist(q[k],q[i]))
			vis[i]=1,dfs(i);
	}
}
int main(){
    cin>>t;
    while(t--){
    	memset(vis,0,sizeof(vis));
        cin>>n>>h>>r;
        pd=0;
        for(int i=1;i<=n;i++)
            cin>>q[i].x>>q[i].y>>q[i].z;
        for(int i=1;i<=n;i++)
        	if(q[i].z<=r)
        		vis[i]=1,dfs(i);
		if(pd)
				cout<<"Yes"<<endl;
        	else
			 	cout<<"No"<<endl;
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1690.07 us3 MB + 880 KBAcceptedScore: 10

Testcase #21.966 ms3 MB + 880 KBAcceptedScore: 10

Testcase #3831.36 us3 MB + 880 KBAcceptedScore: 10

Testcase #42.368 ms3 MB + 880 KBAcceptedScore: 10

Testcase #514.978 ms3 MB + 904 KBAcceptedScore: 10

Testcase #630.043 ms3 MB + 904 KBAcceptedScore: 10

Testcase #760.255 ms3 MB + 904 KBAcceptedScore: 10

Testcase #854.293 ms3 MB + 904 KBAcceptedScore: 10

Testcase #961.493 ms3 MB + 904 KBAcceptedScore: 10

Testcase #1061.289 ms3 MB + 904 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:37:52 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠