0x00 Link
-
Source
-AtCoder
-
Tag
-芝士水题
-
Time
- ∗ * ∗
0x01 Source Code
//
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
const int N = 2222;
struct A {
int x, y;
}in[N];
bool used[N];
queue<A> q;
bool f(const A& x, const A& y, int d) {
return (x.x - y.x) * (x.x - y.x) + (x.y - y.y) * (x.y - y.y) <= d * d;
}
void solve() {
int n, d;
cin >> n >> d;
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
in[i] = (A){x, y};
}
q.push(in[1]);
used[1] = 1;
while (!q.empty()) {
A tt = q.front(); q.pop();
for (int i = 2; i <= n; i++) {
if (used[i]) continue;
if (f(tt, in[i], d)) {
used[i] = 1;
q.push(in[i]);
}
}
}
for (int i = 1; i <= n; i++) {
cout << (used[i] ? "Yes" : "No") << endl;
}
}
signed main() {
IOS
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
0x10 Diagram
-
404
0x11 Reference
-
404
作者 | 乐意奥AI