提交记录 16044


用户 题目 状态 得分 用时 内存 语言 代码长度
SayHanoi noip17d. 【NOIP2017】奶酪 Accepted 100 13.181 ms 72 KB C++ 880 B
提交时间 评测时间
2021-03-19 21:41:10 2021-03-19 21:41:13
#include<bits/stdc++.h>
using namespace std;
int t;
struct Hole{
	double x,y,z;
}ho[1010];
inline double dist(int a,int b){
	double xx=ho[a].x-ho[b].x,yy=ho[a].y-ho[b].y,zz=ho[a].z-ho[b].z;
	return sqrt(xx*xx+yy*yy+zz*zz);
}
int n,h,r,start[1010],cnt;
bool vis[1010],ed[1010],flag;
void dfs(int u){
	if(flag)return;
	if(ed[u]){
		flag=1;
		return;
	}
	for(int i=1;i<=n;i++){
		if(vis[i]||dist(u,i)>(double)(r*2))continue;
		vis[i]=1;
		dfs(i);
	}
	return;
}
int main(){
	scanf("%d",&t);
	while(t--){
		cnt=0;
		flag=0;
		memset(vis,0,sizeof(vis));
		memset(ed,0,sizeof(ed));
		scanf("%d%d%d",&n,&h,&r);
		for(int i=1;i<=n;i++){
			scanf("%lf%lf%lf",&ho[i].x,&ho[i].y,&ho[i].z);
			if(ho[i].z-r<=0)start[++cnt]=i;
			if(ho[i].z+r>=h)ed[i]=1;
		}
		for(int i=1;i<=cnt;i++)
			if(!flag){
			vis[start[i]]=1;dfs(start[i]);
		}
		if(flag)puts("Yes");
		else puts("No");
	}
	return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #137.76 us52 KBAcceptedScore: 10

Testcase #251.81 us52 KBAcceptedScore: 10

Testcase #347.44 us52 KBAcceptedScore: 10

Testcase #475.71 us52 KBAcceptedScore: 10

Testcase #51.062 ms72 KBAcceptedScore: 10

Testcase #66.281 ms72 KBAcceptedScore: 10

Testcase #75.978 ms72 KBAcceptedScore: 10

Testcase #813.181 ms72 KBAcceptedScore: 10

Testcase #95.467 ms72 KBAcceptedScore: 10

Testcase #1011.6 ms72 KBAcceptedScore: 10


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