Created
November 27, 2018 07:47
-
-
Save Semior001/97bfeec9d70d788a1c1648e450110fdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define sqr(a) (a) * (a) | |
using namespace std; | |
const int MAXN = 1000000; | |
int n, c1, c2; | |
int x[MAXN+10], y[MAXN+10], r[MAXN+10]; | |
double dist; | |
int main(){ | |
cin >> n; | |
for(int i = 0; i < n; i++){ | |
cin >> x[i] >> y[i] >> r[i]; | |
} | |
cin >> c1 >> c2; | |
c1--; | |
c2--; | |
dist = sqrt(sqr(x[c1] - x[c2]) + sqr(y[c1] - y[c2])); | |
if(r[c1] + r[c2] >= dist){ | |
cout << "YES" << endl; | |
}else{ | |
cout << "NO" << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment