#pragma GCC optimize("Ofast") #include #include #include #include #include using namespace std; int sq(int x) { return x*x; } int main() { int n; cin >> n; vector> a(n); for(auto& [x,y,r] : a){ cin >> x >> y >> r; } sort(begin(a),end(a)); vector par(n); for(int i=0;i deg(n); for(int i=0;ix+300) break; // early break of doom if(abs(x-ox)+abs(y-oy)<=300) { // simple check to reduce heavy operations. auto D = sq(x-ox)+sq(y-oy); if(D*100<=sq(10/2*(r+oor) +2*254)) { deg[i]++; deg[j]++; // happens few times as graph is really sparse int a = find(i), b = find(j); if(a!=b) { par[a]=b; comps--; } } } } } if(comps!=1 or (n>=7 and *min_element(begin(deg),end(deg))<2)) { cout << "no\n"; } else cout << "yes\n"; }