ABC304c

heyucheng 2023-06-25 20:10:05 9

#include<bits/stdc++.h> using namespace std; const int N=2000+5; int a[N],b[N]; bool c[N]; int main(){ queue q; int n,d; bool f=0; scanf("%d%d",&n,&d); for(int i=1;i<=n;i++){ scanf("%d%d",&a[i],&b[i]); } c[1]=1; q.push(1); while(!q.empty()){ int t=q.front(); q.pop(); for(int i=1;i<=n;i++){ if(c[i]==1){ continue; } if((a[i]-a[t])(a[i]-a[t])+(b[i]-b[t])(b[i]-b[t])<=d*d){ q.push(i); c[i]=1; } } } for(int i=1;i<=n;i++){ if(c[i]==1){ printf("Yes\n"); } else{ printf("No\n"); } } return 0; }

{{ vote && vote.total.up }}

共 1 条回复

heyucheng

怎样格化??