-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathC_Black_Circles.cpp
47 lines (32 loc) · 944 Bytes
/
C_Black_Circles.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RunAt - Green
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define YES cout << "YES\n"
#define NO cout << "NO\n"
void solve() {
int n; cin >> n;
int xInitial, yInitial;
int xFinal, yFinal;
vector<pair<int,int>> coordinates(n);
for (int i=0; i<n; i++) {
cin >> coordinates[i].first;
cin >> coordinates[i].second;
}
cin >> xInitial >> yInitial;
cin >> xFinal >> yFinal;
int minimumDistance = LLONG_MAX;
for (int i=0; i<n; i++) {
int x = coordinates[i].first;
int y = coordinates[i].second;
int distance = (xFinal-x)*(xFinal-x) + (yFinal-y)*(yFinal-y);
minimumDistance = min(minimumDistance, distance);
}
int pathDistance = (xFinal-xInitial)*(xFinal-xInitial) + (yFinal-yInitial)*(yFinal-yInitial);
if (minimumDistance <= pathDistance) {NO;}
else {YES;}
}
int32_t main() {
cin.sync_with_stdio(0); cin.tie(0);
int t; cin >> t; while (t--) solve();
}