Skip to content

Instantly share code, notes, and snippets.

@Semior001
Created November 27, 2018 07:47
Show Gist options
  • Save Semior001/97bfeec9d70d788a1c1648e450110fdf to your computer and use it in GitHub Desktop.
Save Semior001/97bfeec9d70d788a1c1648e450110fdf to your computer and use it in GitHub Desktop.
#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