提交记录 20282


用户 题目 状态 得分 用时 内存 语言 代码长度
wangif424 noip17d. 【NOIP2017】奶酪 Accepted 100 35.256 ms 580 KB C++17 1.66 KB
提交时间 评测时间
2023-10-10 23:42:28 2023-10-10 23:42:34
#include<bits/stdc++.h>
using namespace std;
#define R(x) x=rd()
char buf[1<<23],*p1=buf,*p2=buf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int rd() {
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
    return x*f;
}
char pbuf[1<<20], *pp=pbuf;
inline void push(const char &c){if(pp - pbuf == 1<<20)fwrite(pbuf, 1, 1<<20, stdout),pp = pbuf;*pp++ = c;}
class io{public:~io(){fwrite(pbuf, 1, pp - pbuf, stdout);}}_;
inline void write(int x) {
	if (x<0)x=-x,push('-');
	int sta[35],top=0;
	do{sta[top++]=x%10,x/=10;}while (x);
	while(top)push(sta[--top]^'0');
}
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])){
				push('Y');
				push('e');
				push('s');
				push('\n');
				return;
			}
		}
	}
	push('N');
	push('o');
	push('\n');
	return;
}
signed main(){
	R(t);
	while(t--){
		ls=le=0;
//		cin >> n >> h >> r;
		R(n);
		R(h);
		R(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];
			R(x[i]);
			R(y[i]);
			R(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 #141.04 us68 KBAcceptedScore: 10

Testcase #236.53 us68 KBAcceptedScore: 10

Testcase #336.48 us68 KBAcceptedScore: 10

Testcase #447.55 us68 KBAcceptedScore: 10

Testcase #58.864 ms144 KBAcceptedScore: 10

Testcase #617.704 ms220 KBAcceptedScore: 10

Testcase #735.256 ms372 KBAcceptedScore: 10

Testcase #831.676 ms340 KBAcceptedScore: 10

Testcase #933.543 ms580 KBAcceptedScore: 10

Testcase #1033.589 ms580 KBAcceptedScore: 10


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