提交记录 11304


用户 题目 状态 得分 用时 内存 语言 代码长度
wangtian1213 noip17d. 【NOIP2017】奶酪 Wrong Answer 80 20.422 ms 68 KB C++11 1023 B
提交时间 评测时间
2019-11-14 10:46:35 2020-08-01 02:41:34
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1005;
ll fa[N],n,h,r,x[N],y[N],z[N];
ll find(ll x) {
	if (x!=fa[x]) fa[x]=find(fa[x]);
	return fa[x];
}
void comb(ll x,ll y) {
	x=find(x),y=find(y);
	if (x==y) return;
	fa[x]=y;
}
bool dis(ll x,ll y,ll z,ll r) {
	return x*x+y*y<=4*r*r-z*z;
}
int main() {
	ll T; scanf("%lld",&T);
	while (T--) {
		scanf("%lld%lld%lld",&n,&h,&r);
		for (ll i=1; i<=n; i++) scanf("%lld%lld%lld",&x[i],&y[i],&z[i]);
		for (ll i=1; i<=n; i++) fa[i]=i;
		for (ll i=1; i<=n; i++)
			for (ll j=i+1; j<=n; j++) {
				if (dis(x[i]-x[j],y[i]-y[j],z[i]-z[j],r))
					comb(i,j); 
//				printf("!!! %d %d  %lld %lld %lld\n",i,j,x[i]-x[j],y[i]-y[j],z[i]-z[j]);
			}
		bool flag=false;
		for (ll i=1; i<=n; i++) {
			for (ll j=i; j<=n; j++)
				if (z[i]<=r && z[j]>=h-r && find(i)==find(j)) {
					flag=true; break; 
				}
			if (flag) break;
		}
		if (flag) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}
/*
3
2 4 1
0 0 1
0 0 3
2 5 1
0 0 1
0 0 4
2 5 2
0 0 2
2 0 4
*/

CompilationN/AN/ACompile OKScore: N/A

Testcase #135.97 us52 KBAcceptedScore: 10

Testcase #248.7 us52 KBAcceptedScore: 10

Testcase #340.71 us52 KBAcceptedScore: 10

Testcase #472.79 us52 KBWrong AnswerScore: 0

Testcase #54.695 ms68 KBAcceptedScore: 10

Testcase #68.742 ms68 KBAcceptedScore: 10

Testcase #720.321 ms68 KBWrong AnswerScore: 0

Testcase #817.469 ms68 KBAcceptedScore: 10

Testcase #920.422 ms68 KBAcceptedScore: 10

Testcase #1019.687 ms68 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-28 01:48:00 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠