提交记录 17906


用户 题目 状态 得分 用时 内存 语言 代码长度
Z_301 noip17d. 【NOIP2017】奶酪 Accepted 100 11.897 ms 72 KB C++11 1.33 KB
提交时间 评测时间
2022-07-29 14:41:31 2022-07-29 14:41:40
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#include<bits/stdc++.h>
#define For(i,l,r) for(int i=l,i##end=r;i<=i##end;i++)
#define rFor(i,r,l) for(int i=r,i##end=l;i>=i##end;i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
inline void wrt(int x,const char endc=10) {
	static char buf[21],*nw;nw=buf;
	if(!x){putchar(48);goto end;}
	if(x<0)putchar(45),x=-x;
	while(x)*(nw++)=x%10+48,x/=10;
	while(nw!=buf)putchar(*(--nw));
	end:putchar(endc);
}
inline int _isdigit(const char x){return x>47 and x<58;}
inline int rd() {
	static int f,x;
	static char c;
	f=x=0;
	do if((c=getchar())==45)f=1;while(!_isdigit(c));
	do x=(x<<1)+(x<<3)+c-48;while(_isdigit(c=getchar()));
	return f?-x:x;
}
int n,f[1010];
int fd(const int x){return f[x]==x?x:f[x]=fd(f[x]);}
inline ll sqr(const ll x){return x*x;}
void mg(const int a,const int b){f[fd(a)]=fd(b);}
void work()
{
	static ll x[1010],y[1010],z[1010],h,r;
	static int n;
	n=rd(),h=rd(),r=rd();
	For(i,0,n+1)f[i]=i;
	For(i,1,n) {
		x[i]=rd(),y[i]=rd(),z[i]=rd();
		if(z[i]<=r)mg(0,i);
		if(r+z[i]>=h)mg(i,n+1);
	}
	For(i,1,n)
		For(j,i+1,n)
			if(sqr(x[i]-x[j])+sqr(y[i]-y[j])+sqr(z[i]-z[j])<=r*r<<2)
				mg(i,j);
	static const string anss[]={"No","Yes"};
	puts(anss[fd(0)==fd(n+1)].c_str());
}
int main() {
	For(i,1,rd())work();
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #138.25 us52 KBAcceptedScore: 10

Testcase #246.8 us52 KBAcceptedScore: 10

Testcase #346.12 us52 KBAcceptedScore: 10

Testcase #463.09 us52 KBAcceptedScore: 10

Testcase #53.038 ms72 KBAcceptedScore: 10

Testcase #66.059 ms68 KBAcceptedScore: 10

Testcase #711.897 ms72 KBAcceptedScore: 10

Testcase #810.698 ms68 KBAcceptedScore: 10

Testcase #911.625 ms68 KBAcceptedScore: 10

Testcase #1011.73 ms64 KBAcceptedScore: 10


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