提交记录 11306


用户 题目 状态 得分 用时 内存 语言 代码长度
wangtian1213 noip17d. 【NOIP2017】奶酪 Accepted 100 7.826 ms 68 KB C++11 1.04 KB
提交时间 评测时间
2019-11-14 10:58:23 2020-08-01 02:41:37
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
long long x[1005],y[1005],z[1005],n,h,r;
bool beg[1005],End[1005],flag,color[1005];
long double check(int i,int j){
    long double t1=x[i]-x[j];
    long double t2=y[i]-y[j];
    long double t3=z[i]-z[j];
    return (long double)sqrt(t1*t1+t2*t2+t3*t3);
}
void dfs(int x){
	color[x]=true;
	if (End[x]) flag=true;
	for (int i=1;i<=n;i++){
	    if (!color[i] && check(x,i)<=(long double)2*r)
	        dfs(i);
	    if (flag) return;
	}
}
int main(){
	int cas;
    scanf("%d",&cas);
    while (cas--){
    	scanf("%lld%lld%lld",&n,&h,&r);
    	for (int i=1;i<=n;i++)
            beg[i]=End[i]=color[i]=false;
    	for (int i=1;i<=n;i++){
    	    scanf("%lld%lld%lld",&x[i],&y[i],&z[i]);
    	    if (z[i]-r<=0)
    	        beg[i]=true;
    	    if (z[i]+r>=h)
    	        End[i]=true;
    	}
    	flag=false;
    	for (int i=1;i<=n;i++)
    	    if (!color[i] && beg[i])
    	        dfs(i);
        if (flag)
             printf("Yes\n"); else
             printf("No\n");
    }
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #135.59 us56 KBAcceptedScore: 10

Testcase #251.03 us56 KBAcceptedScore: 10

Testcase #347.91 us56 KBAcceptedScore: 10

Testcase #461.52 us56 KBAcceptedScore: 10

Testcase #51.329 ms64 KBAcceptedScore: 10

Testcase #63.022 ms64 KBAcceptedScore: 10

Testcase #77.826 ms68 KBAcceptedScore: 10

Testcase #86.081 ms64 KBAcceptedScore: 10

Testcase #96.2 ms64 KBAcceptedScore: 10

Testcase #105.818 ms64 KBAcceptedScore: 10


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