Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const int32_t INF = 1 << 30; struct Circle { int32_t x, y, r; }; int get_pos(Circle a, Circle b) { int32_t dist = pow(a.x - b.x, 2) + pow(a.y - b.y, 2); int32_t sum2 = pow(a.r + b.r, 2); int32_t sub = a.r - b.r; int32_t sub2 = pow(sub, 2); if (dist >= sum2) retu...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.*; import java.util.*; import java.util.regex.*; public class Main { static Scanner scan = new Scanner (System.in); static PrintStream out = System.out; static int[][] d = new int[2][4]; static int dis = 0; static int checkCircle (int r1, int r2) { if (dis >= (r1 + r2) * (r1 + r2)) retu...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { int x1, y1, x2, y2, r1, r2, R1, R2, res; double dist; while (cin >> x1 >> y1 >> r1 >> R1) { cin >> x2 >> y2 >> r2 >> R2; int cnt = 0; dist = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); dist = sqrt(dist); bool fin, fout, sin, sout; ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double d = 0; bool intersect(int, int); bool belong(int, int); bool none(int, int); void solve() { int x1, y1, r1, R1, x2, y2, r2, R2; cin >> x1 >> y1 >> r1 >> R1; cin >> x2 >> y2 >> r2 >> R2; int x = abs(x1 - x2); int y = abs(y1 - y2); d = sqrt(x * x + y * y); ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int x[3], y[3], r[3], R[3]; int main() { for (int i = 1; i <= 2; i++) scanf("%d %d %d %d", &x[i], &y[i], &r[i], &R[i]); int count = 0; double d = sqrt(((x[1] - x[2]) * (x[1] - x[2])) + ((y[1] - y[2]) * (y[1] - y[2]))); if ((d == ((r[1] + R[1]) / 2.0)) && (2 * ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 4; const long long MOD = 1e9 + 7; bool check(long double x1, long double EsiHancagorcRepa, int r, long double x2, long double y2, int ner, int art) { long double dist = sqrtl((x1 - x2) * (x1 - x2) + (EsiHancagorcRe...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import os import sys from io import BytesIO, IOBase from collections import Counter BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r" not in file.mode self.write...
PYTHON3
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct Circle { long double h, k, r; }; vector<Circle> circles; bool possible[4]; void solve() { long double d = sqrt(pow(circles[0].h - circles[2].h, 2) + pow(circles[0].k - circles[2].k, 2)); for (int i = 0; i < 4; i++) { Circle &c = circl...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int cmp(void const *x, void const *y) { long a = *(long *)x; long b = *(long *)y; return a - b; } double ab(double a) { if (a < 0) a *= -1; return a; } long n, m, k, l, i, j, t = 0; double x1, y_1, r1, R1; double x2, y2, r2, R2; double d; int main() { scanf("%lf...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist(long long x0, long long x1, long long y0, long long y1) { long long x = (x0 - x1); long long y = (y0 - y1); return sqrt(x * x + y * y); } bool check(long long r0, long long r1, long long r2, double &d) { if (d + r0 <= r1) return true; if (r0 + r2 <= d)...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; template <class T> ostream& operator<<(ostream& os, vector<T> V) { for (auto v : V) os << v << " "; return cout << ""; } template <class T> ostream& operator<<(ostream& os, set<T> S) { for (auto s : S) os << s << " "; return cout << ""; } template <class L, class R>...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct circle { int x, y, r; circle(int a, int b, int c) { x = a, y = b, r = c; } }; vector<circle> v1, v2; double dist(circle a, circle b) { return sqrt((double)(a.x - b.x) * (a.x - b.x) + (double)(a.y - b.y) * (a.y - b.y)); } int main() { int x, y, r...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double x[10], y[10], r[10], l; double sqr(double x) { return x * x; } bool solve(double r1, double r2, double r3) { return (sqr(r1 + r3) <= l || (r2 > r1 && l <= sqr(r2 - r1)) || (r1 > r3 && l <= sqr(r1 - r3))); } int main() { for (int i = 0; i < 2; i++) cin >...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("unroll-loops") using namespace std; template <typename A> ostream &operator<<(ostream &cout, vector<A> const &v); template <typename A, typename B> ostream &operato...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> long long int const MOD = 1000000007; long long int const N = 1000005; long long int const LN = 20; long long int const inf = 1e18 + 5; using namespace std; long long int n, m, a[N]; long long int dist(long long int x1, long long int y1, long long int x2, long long int y2) { ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int contact(complex<double> p1, double r1, complex<double> p2, double r2) { double d = abs(p2 - p1); if (r1 + r2 < d + 1e-7) return 0; if (d + r2 < r1 + 1e-7) return -1; if (d + r1 < r2 + 1e-7) return -2; return 1; } int main() { double x, y; complex<double> p...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("no-stack-protector") #pragma GCC target("sse,sse2,ssse3,sse3,sse4,popcnt,avx,mmx,abm,tune=native") using namespace std; signed main() { cin.tie(nullptr)->sync_with_stdio(false); auto sq = [&](long long x) ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
from math import sqrt def dist(x1,y1,x2,y2): return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)) def circleInCircle(x1,y1,r1,x2,y2,r2): centerDist = dist(x1,y1,x2,y2) return centerDist + r1 <= r2 def circleOutsideCircle(x1,y1,r1,x2,y2,r2): centerDist = dist(x1,y1,x2,y2) if(abs(centerDist + r1) >= r2 and abs(centerDis...
PYTHON3
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); double fixAngle(double A) { return A > 1 ? 1 : (A < -1 ? -1 : A); } double dcmp(double a, double b) { return fabs(a - b) < 1e-6 ? 0 : a > b ? 1 : -1; } enum State { CONTAIN, INSIDE, INTERSECT, APART, SAME }; State check(int x, int y, int r1, ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int x, y, xx, yy, r, R, rr, RR; int D(int x) { return x * x; } int main() { scanf("%d%d%d%d", &x, &y, &r, &R); scanf("%d%d%d%d", &xx, &yy, &rr, &RR); int d = D(x - xx) + D(y - yy), ans = 4; if ((d < D(r + rr) && d > D(r - rr)) || (d < D(r + RR) && d > D(r - RR)) || ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> template <class T> inline T qmin(T a, T b) { return a < b ? a : b; } template <class T> inline T qmax(T a, T b) { return a > b ? a : b; } const double eps = 1e-7; const double PI = acos(-1); const int inf = 0x3f3f3f3f; const int mod = (int)1e9 + 1; const int maxn = (int)1e5 + 5; const long ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.util.*; import java.awt.geom.*; import java.io.*; public class Main{ class InStream{ BufferedReader in; StringTokenizer st; public InStream() { this.in = new BufferedReader(new InputStreamReader(System.in)); this.st = null; } ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int r[2], R[2], x[2], y[2]; int ans; void f(int i, int j) { int dist = (x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]); if (dist >= (r[i] + R[j]) * (r[i] + R[j])) ans++; else { if (r[j] >= r[i] && dist <= (r[j] - r[i]) * (r[j] - r[i]) && R[j] >= ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.util.*; public class cf199b { public static void main(String[] args) { Scanner in = new Scanner(System.in); Circle[] circles = new Circle[4]; int x = in.nextInt(); int y = in.nextInt(); circles[0] = new Circle(x,y,in.nextInt()); circles[1] = new Circle(x,y,in.nextInt()); x = in.nextInt(); ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double EPS = 1e-9; struct CIRCLE { int x; int y; int r; }; int x1, y1_, r1, R1; int x2, y2_, r2, R2; float dist(CIRCLE from, CIRCLE to) { return sqrt(pow(from.x - to.x, 2) + pow(from.y - to.y, 2)); } bool inter(CIRCLE A, CIRCLE B) { if (dist(A, B) >= A.r + B.r) re...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { long long int x1, y1, x2, y2, r1, R1, r2, R2; cin >> x1 >> y1 >> r1 >> R1; cin >> x2 >> y2 >> r2 >> R2; x1 *= 10000; x2 *= 10000; y1 *= 10000; y2 *= 10000; r1 *= 10000; r2 *= 10000; R1 *= 10000; R2 *= 10000; vector<bool> good(4, true); ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> int main() { int x1, y1, r1, R1, x2, y2, r2, R2; scanf("%d%d%d%d%d%d%d%d", &x1, &y1, &r1, &R1, &x2, &y2, &r2, &R2); double p = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); printf("%d", (r1 + p <= r2 || R2 + p <= r1 || R2 + r1 <= p) + (R1 + p <= r2 || R2 + p <=...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct circle { int x, y, r, R; }; int i, j, k, m, n, l; circle c[2]; int cal(circle c1, circle c2) { int ret = 0; int dis = ((c1.x - c2.x) * (c1.x - c2.x)) + ((c1.y - c2.y) * (c1.y - c2.y)); if (c2.r >= c1.r && ((c2.r - c1.r) * (c2.r - c1.r)) >= dis) { ret++; ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
//package contest_125_div2; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.StreamTokenizer; import java.io.Writer; /** * Date : Jul 8, 2012 ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> double zero = 1e-8; struct Tring { int x, y, r, R; } a[3]; int result; double d; bool jiao(double r1, double r2) { return ((d <= r1 + r2 - zero) && (d >= fabs(r1 - r2) + zero)); } int main() { int i, j; for (i = 1; i <= 2; ++i) scanf("%d%d%d%d", &a[i].x, &a[i].y, &a[i].r, &a[i].R); ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct k { int x, y, r, R; }; bool inter(int x1, int y1, int r1, int x2, int y2, int r2) { int d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); return (d >= (r1 + r2) * (r1 + r2)) || (d < ((r1 + r2) * (r1 + r2)) && d <= ((r1 - r2) * (r1 - r2))); } int main(...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; long long dist; inline bool check(int r1, int r2, int R2) { if (dist >= ((r1 + R2) * (r1 + R2))) { return true; } if (dist <= abs((r1 - R2) * (r1 - R2)) && (R2 <= r1)) { return true; } if (dist <= abs((r1 - r2) * (r1 - r2)) && (r1 <= r2)) { return true...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct ring { int c1; int c2; int r1; int r2; }; int contour(struct ring a, struct ring b, double dist) { int cnt = 0; if (dist >= a.r2 + b.r2 || dist <= b.r1 - a.r2 || dist <= a.r2 - b.r2) cnt++; if (dist >= a.r1 + b.r2 || dist <= b.r1 - a.r1 || dist <= a.r1 ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int c = 0; int check(int x, int y, int r, int xa, int ya, int r1, int r2) { double dis = sqrt((x - xa) * (x - xa) + (y - ya) * (y - ya)); if ((dis >= r + r1 && dis >= r + r2) || (dis <= abs(r1 - r) && dis <= abs(r2 - r) && (r2 - r) * (r1 - r) > 0)) { c++; } ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist; int check(double ri1, double ro1, double ri2, double ro2) { int ans = 0; if (dist + ro1 <= ri2 || dist >= ro1 + ro2 || dist + ro2 <= ro1) ans++; if (dist + ri1 <= ri2 || dist >= ri1 + ro2 || dist + ro2 <= ri1) ans++; return ans; } int main(void) { dou...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { long double x1, y1, i1, o1, x2, y2, i2, o2, d; int ans = 0; cin >> x1 >> y1 >> i1 >> o1 >> x2 >> y2 >> i2 >> o2; d = sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1))); if (d <= i2 - i1 || d >= o2 + i1 || d <= i1 - o2) ans++; if (d <= i2 - o1 |...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { double x1, y1, x2, y2, r1, r2, R1, R2; cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2; double di = sqrt((double)((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))); int ans = 0; if (di + r1 <= r2 || abs(di - r1) >= R2) ans++; if (di + R1 <= r2 || ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int n, m; bool check(int r0, int r, int R, int l1) { double l = sqrt((double)l1); if (l >= R + r0 || l + r0 <= r || r0 - l >= R) return true; else return false; } int main() { int x1, y1, x2, y2, r1, r2, R1, R2, res = 0; cin >> x1 >> y1 >> r1 >> R1 >> x2 >...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using pld = pair<ld, ld>; inline int sq(const int a) { return a * a; } inline bool is_good(const pii &cent1,...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int Sx[4], Sy[4], R[4]; bool ok[4]; int main() { scanf("%d%d%d%d", Sx, Sy, R, R + 1); scanf("%d%d%d%d", Sx + 1, Sy + 1, R + 2, R + 3); int i; int dist = (Sx[0] - Sx[1]) * (Sx[0] - Sx[1]) + (Sy[0] - Sy[1]) * (Sy[0] - Sy[1]); for (i = 0; i < 4; i++) ok[i] = fa...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#!/usr/bin/python import math def dist(x1, y1, x2, y2): return math.sqrt((x1 - x2)**2 + (y1 - y2)**2) def intersect(x1, y1, r, x2, y2, r2, R2): d = dist(x1, y1, x2, y2) if d >= r + R2 or d + r <= r2 or d + R2 <= r: return 1 return 0 x1, y1, r1, R1 = [int(x) for x in raw_input().split()] x2...
PYTHON
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } long long binpow(long long a, long long b) { long long res = 1; while (b) { if (b & 1) res = (res * a) % MOD; a = (a * a) % MOD; b >>= 1; } return res; } long long mod...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int solve(long double sx, long double sy, long double nx, long double ny, long double x, long double y) { long double dis = sqrt((sx - nx) * (sx - nx) + (sy - ny) * (sy - ny)); if (dis >= x + y) return 1; else if (x + dis <= y) return 2; else if (y...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int x1, yy1, r1, R1; int x2, y2, r2, R2; int dis; inline bool inside(int r, int R) { double dist = sqrt((double)dis); if (dist <= double(R - r)) return true; return false; } inline bool outside(int r, int R) { double dist = sqrt((double)dis); if (dist >= double(R ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x1 = sc.nextInt(); int y1 = sc.nextInt(); int r1 = sc.nextInt(); int R1 = sc.nextInt(); int x2 = sc.nextInt(); int y2 = sc.nextI...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double d, r1, r2, R1, R2; bool ok(double rin, double rout, double r) { if (d + r <= rin or (r + rout) <= d or d + rout <= r) return 1; return 0; } int32_t main() { long long x1, y1, x2, y2; cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2; d = sqrt((x1 - x2) * ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int a[2][4], ans = 0, d2; bool chk(int r1, int r2, int R, int d) { if (d > max(R * R, r2 * r2)) return (d >= (R + r2) * (R + r2)); if (d <= (R - r2) * (R - r2) && R >= r2) return true; else if (d <= (r1 - R) * (r1 - R) && R <= r1) return true; return false; ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist(int x1, int y1, int x2, int y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); } int main() { int x1, y1, r1, R1, x2, y2, r2, R2; cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2; int k = 0; double d1 = dist(x1, y1, x2, y2); if (d1 >= R1 + R2 |...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.*; import java.awt.geom.Point2D; import java.text.*; import java.math.*; import java.util.*; public class Main implements Runnable { final String filename = ""; public void solve() throws Exception { int[] r = new int[2], R = new int[2]; int x1 = iread(), y1 = iread(); r[0] = iread(); R[0] ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:200000000") using namespace std; const int INF = (int)1E9; const long long INF64 = (long long)1E18; const long double EPS = 1E-9; const long double PI = 3.1415926535897932384626433832795; long long x[10], y[10], r[10], l; long long sqr(long long x) { return x * x...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
def cross(x, y, r, x0, y0, r1, r2): d = (x0 - x) ** 2 + (y0 - y) ** 2 return 1 if (d >= (r + r2) ** 2) or (r < r1 and d <= (r1 - r) ** 2) or \ (r2 < r and d <= (r - r2) ** 2) else 0 x1, y1, r1, R1 = map(int, raw_input().split()) x2, y2, r2, R2 = map(int, raw_input().split()) print cross(x1, y1, r1, x2,...
PYTHON
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct ring { int x, y, r1, r2; } a, b; int sqr(int x) { return x * x; } int solve() { int d = sqr(a.x - b.x) + sqr(a.y - b.y); if (d >= sqr(a.r2 + b.r2)) return 4; int cnt = 0; if (d >= sqr(max(a.r2, b.r2))) { if (d >= sqr(a.r1 + b.r2)) cnt++; if (d >= sq...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double x[2], y[2], r[2], R[2]; void solve() { double dx = x[0] - x[1]; double dy = y[0] - y[1]; double d = sqrt(dx * dx + dy * dy); int ans = 0; if (r[0] + R[1] <= d || d + r[0] <= r[1] || d + R[1] <= r[0]) ans++; if (R[0] + R[1] <= d || d + R[0] <= r[1] || d + ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; using ll = long long; struct node { double x, y, r1, r2; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); vector<node> v(2); int ans = 0; for (int i = 0; i < 2; i++) cin >> v[i].x >> v[i].y >> v[i].r1 >> v[i].r2; double d = sqrt((v[0].x - v[1]....
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> double l; double dist(int x, int y, int x1, int y1) { return sqrt((double)((x - x1) * (x - x1) + (y - y1) * (y - y1))); } bool f(int r, int r1, int r2) { if (l >= r + r2) return true; if (l + r2 <= r) return true; if (l + r <= r1) return true; return false; } int main() { int x1, x2...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); double fixAngle(double A) { return A > 1 ? 1 : (A < -1 ? -1 : A); } double dcmp(double a, double b) { return fabs(a - b) < 1e-6 ? 0 : a > b ? 1 : -1; } enum State { CONTAIN, INSIDE, INTERSECT, APART, SAME }; State check(int x, int y, int r1, ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist; bool isCut(int r1, int r2) { if (r1 + r2 <= dist) return false; if (r1 + dist <= r2) return false; if (r2 + dist <= r1) return false; return true; } bool in(int r1, int r2) { if (r1 + r2 <= dist) return false; if (r1 >= r2) return false; return tr...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; template <class T> inline T min(T a, T b, T c) { return min(min(a, b), c); } template <class T> inline T max(T a, T b, T c) { return max(max(a, b), c); } template <class T> inline T min(T a, T b, T c, T d) { return min(min(a, b), min(c, d)); } template <class T> inlin...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; pair<int, int> p1, p2; int r1, r2, R1, R2, ans; int main() { cin >> p1.first >> p1.second >> r1 >> R1; cin >> p2.first >> p2.second >> r2 >> R2; double dis = sqrt((p1.first - p2.first) * (p1.first - p2.first) + (p1.second - p2.second) * (p1.second ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; template <class T> T mabs(T a) { if (a < 0) return -a; return a; } bool in_circ(double r1, double dist, double r2) { return mabs(dist - r2) <= r1 && dist + r2 <= r1; } bool out_circ(double r1, double dist, double r2) { return mabs(dist - r2) >= r1 && dist + r2 >= r1...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int intersect(int x1, int y1, int r1, int x2, int y2, int r2) { double dist = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); return dist > abs(r1 - r2) && dist < (r1 + r2); } int equal(int x1, int y1, int r1, int x2, int y2, int r2) { return x1 == x2 && y1 == y2...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class SpecialOlympics { static class Cir...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << "\t"; err(++it, args...); } template <typename T1, typename T2> ostream& operator<<(os...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> bool cross(int x1, int y1, int r1, int x2, int y2, int r2) { int t = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); if (t >= (r1 + r2) * (r1 + r2)) return 0; else if (r2 > r1 && t < r2 * r2 && t <= (r2 - r1) * (r2 - r1)) return 0; else if (r1 > r2 && t < r1 * r1 && t <= (r2 - r1...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist(double x1, double x2, double y1, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } bool in_circle(double d, double r1, double r2) { return d + r1 <= r2; } bool out_circle(double d, double r1, double r2) { if (d >= r1 + r2) return tru...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; bool noCollide(int x1, int y1, int r1, int x2, int y2, int r2, int R2) { int d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); int rd1 = (r1 - r2) * (r1 - r2); int rd2 = (r1 + r2) * (r1 + r2); int Rd1 = (r1 - R2) * (r1 - R2); int Rd2 = (r1 + R2) * (r1 + R2); if...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double x[5], y[5], r[5]; int fg[4]; bool bh(double x1, double y1, double r1, double x2, double y2, double r2) { if ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= (r2 - r1) * (r2 - r1)) return true; return false; } bool xj(double x1, double y1, double r1, double x...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct circle { int x, y, r, R; } c1, c2; int ans; double d; void check(circle a, circle b) { if (b.R + a.r <= d || b.r - a.r >= d || a.r - b.R >= d) ans++; if (b.R + a.R <= d || b.r - a.R >= d || a.R - b.R >= d) ans++; } int main() { while (cin >> c1.x >> c1.y >> c...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double eps; int main() { double x1, y1, x2, y2, r1, r2, R1, R2; eps = 0.0000000001; cin >> x1 >> y1 >> r1 >> R1; cin >> x2 >> y2 >> r2 >> R2; double di = sqrt((double)((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))); int ans = 0; if (di + r1 <= r2 + eps || abs...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; int evcD2(int x1, int y1, int x2, int y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } int check(int x1, int y1, int r, int x2, int y2, int R) { int dst = evcD2(x1, y1, x2, y2); double dst1 = sqrt(double(dst)); if (r - dst1 > R ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
def is_intersect(r1, r2, R, x1, y1, x2, y2): d = (x1 - x2)**2 + (y1 - y2)**2 return d >= (r1 + R)**2 or r1 < r2 and d <= (r2 - r1)**2 or R < r1 and d <= (r1 - R)**2 x1, y1, r1, R1 = map(int, input().split()) x2, y2, r2, R2 = map(int, input().split()) res1 = is_intersect(r1, r2, R2, x1, y1, x2, y2) res2 = is_i...
PYTHON3
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> const int fin = 0; long long x[2], y[2], r[2], R[2]; int main() { if (fin) { freopen("t.in", "r", stdin); freopen("t.out", "w", stdout); } int i, j, ans = 0; long long t; for (i = 0; i < 2; ++i) scanf("%I64d%I64d%I64d%I64d", x + i, y + i, r + i, R + i); t = (x[1] - x[0])...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double dist(double x1, double y1, double x2, double y2) { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); } bool cross(double x1, double y1, double r1, double x2, double y2, int r2) { double d = dist(x1, y1, x2, y2); if (d >= r1 + r2 || d <= abs(r1 - r2)) ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
from math import sqrt import sys read_ints = lambda f: [int(num) for num in f.readline().split()] f = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin x1, y1, r1, R1 = read_ints(f) x2, y2, r2, R2 = read_ints(f) c1 = (x1, y1, r1) C1 = (x1, y1, R1) c2 = (x2, y2, r2) C2 = (x2, y2, R2) dist = sqrt((x1 - x2) ** 2 +...
PYTHON
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
/** * Created by IntelliJ IDEA. * User: SONY * Date: 27.05.12 * Time: 18:25 * To change this template use File | Settings | File Templates. */ import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class TaskB extends Thread { ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import math def dist(x, y, a, b): return math.sqrt((x - a) ** 2 + (y - b) ** 2) result = 0 x1, y1, r1, R1 = map(int, input().split()) x2, y2, r2, R2 = map(int, input().split()) if dist(x1, y1, x2, y2) >= R1 + R2 or \ dist(x1, y1, x2, y2) + R2 <= R1 or \ dist(x1, y1, x2, y2) + R1 <= r2: result += 1 i...
PYTHON3
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const int MAXN = 46; struct node { double x, y; double r1, r2; double o; } C[2]; struct circle { double o, r1, r2; } c[2]; const double eps = 1e-6; bool ok(double r, double x1, double x2) { if (r <= x1 || r >= x2) return true; else return false; } bool o...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int fh(int X, int Y, int R, int tx, int ty, int tr) { if (((R + tr) * (R + tr)) <= ((X - tx) * (X - tx) + (Y - ty) * (Y - ty))) return 1; return 0; } int fh2(int X, int Y, int R, int tx, int ty, int tr) { if (((R - tr) * (R - tr)) >= ((X - tx) * (X - tx) + (Y - ty...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct circle { double x, y, r, rr; }; circle a, b; int ans = 0; double dist; bool per(double dist, double r1, double r, double rr) { if (dist >= r1 + rr || dist + r1 <= r || dist + rr <= r1) return false; else return true; } int main() { cin >> a.x >> a.y >...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Locale; import java.util.StringTokenizer; public class A { int gcd(int a, int b){ return (b!=0)? gcd(b, a%b): a; } int check(int r...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.*; import java.text.*; import java.math.*; import java.util.*; public class Olympic implements Runnable { final static String taskname = "filename"; public void solve() throws Exception { // int n = iread(); String input1[] = in.readLine().split(" +"); int[] r = new int...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { double x1, y1, r1, R1; double x2, y2, r2, R2; cin >> x1 >> y1 >> r1 >> R1; cin >> x2 >> y2 >> r2 >> R2; double l = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); int ret = 0; if (l < r1 && l + R2 <= r1 || l > r1 && l - R2 >= r1 || r1 <= r2 -...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int x[4], y[4], r[4]; double Sqr(double a) { return a * a; } int check(int i, int j) { double d = sqrt(Sqr(double(x[i]) - x[j]) + Sqr(double(y[i]) - y[j])); if (r[i] + r[j] <= d) return 0; if (r[i] - r[j] >= d) return 1; if (r[j] - r[i] >= d) return 2; return -1; ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.*; import java.awt.geom.Point2D; import java.text.*; import java.math.*; import java.util.*; public class Main implements Runnable { final String filename = ""; public void solve() throws Exception { int[] r = new int[2], R = new int[2]; int x1 = iread(), y1 = iread(); r[0] = iread(); R[0] ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { long long(x1), (y1); scanf("%lld%lld", &(x1), &(y1)); ; long long(r1), (R1); scanf("%lld%lld", &(r1), &(R1)); ; long long(x2), (y2); scanf("%lld%lld", &(x2), &(y2)); ; long long(r2), (R2); scanf("%lld%lld", &(r2), &(R2)); ; auto dist =...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double x[5], y[5], r[5]; int fg[4]; bool bh(double x1, double y1, double r1, double x2, double y2, double r2) { if ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= (r2 - r1) * (r2 - r1)) return true; return false; } bool xj(double x1, double y1, double r1, double x...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> struct circle { double x, y, r; }; double dis(circle a, circle b) { return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)); } bool canGo(circle tar, circle small, circle big) { if (small.r >= tar.r + dis(tar, small)) return true; if (big.r + tar.r <= dis(tar, big)) return tr...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; unsigned long long gcd(unsigned long long a, unsigned long long b) { unsigned long long c; while (a != 0) { c = a; a = b % a; b = c; } return b; } bool get(int x, int y, int r, int xx, int yy, int R, int RR) { return ((sqrt(((x - xx) * (x - xx)) + ((y ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int dist(int xi, int yi, int xj, int yj) { return (xi - xj) * (xi - xj) + (yi - yj) * (yi - yj); } bool isok(int r1, int r2, int r3, int dis) { for (int i = r2; i <= r3; i++) { if ((r1 + i) * (r1 + i) > dis && dis > abs(r1 - i) * abs(r1 - i)) { return false; ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct ring { float x, y, ri, ro; }; float distance_formula(float x1, float y1, float x2, float y2) { return pow(((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)), 0.5); } void hehe() { ring r1, r2; cin >> r1.x >> r1.y >> r1.ri >> r1.ro; cin >> r2.x >> r2.y >> r2.ri...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { int x1, y1, r1, R1 = 0; int x2, y2, r2, R2 = 0; cin >> x1 >> y1 >> r1 >> R1; cin >> x2 >> y2 >> r2 >> R2; double d = sqrt((double)(((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)))); int c = 0; if (r1 + R2 <= d || r2 - r1 >= d || r1 - R2 >= d) c++;...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; double x[5], y[5], r[5]; int fg[4]; bool bh(double x1, double y1, double r1, double x2, double y2, double r2) { if ((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) <= (r2 - r1) * (r2 - r1)) return true; return false; } bool xj(double x1, double y1, double r1, double x...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.*; import java.util.*; public class Main { boolean nc(int x1, int y1, int r1, int x2, int y2, int r2) { boolean ans = true; double Ro = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); if (getSqrt(Ro, 100) + r1 <= r2 || getSqrt(Ro, 100) + r2 <= r1) { return true; ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int main() { int ax, ay, ar, arr, bx, by, br, brr; scanf("%d%d%d%d", &ax, &ay, &ar, &arr); scanf("%d%d%d%d", &bx, &by, &br, &brr); double d; d = sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by)); int flag1 = 1, flag2 = 1, flag3 = 1, flag4 = 1; if (ar + br > ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class SpecialOlympics { static class Scanner{ BufferedReader br=null; StringTokenizer tk=null; public Scanner(){ br=new BufferedReader(new InputStreamReader(System.in)); ...
JAVA
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; int contact(int x1, int y1, int r1, int x2, int y2, int r2) { int dx = x1 - x2, dy = y1 - y2; int sq_dist = dx * dx + dy * dy; if (sq_dist >= (r1 + r2) * (r1 + r2)) return -1; else if (sq_dist <= (r1 - r2) * (r1 - r2)) { return (r1 < r2) ? +1 : -1; } else ...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 100 + 10; double dis; int fun(double a, double b, double c) { if (a - c >= dis || b - a >= dis || a + c <= dis) return 1; return 0; } int main() { double o1, o2, o3, o4; double r1, r2, r3, r4; scanf("%lf%lf%lf%lf", &o1, &o2, &r1, &r2); scanf("%lf%l...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; const int N = 1e9; struct node { int x, y, R, r; void read() { scanf("%d%d%d%d", &x, &y, &r, &R); } } a, b; int ans; bool check(int x, int y, int r) { bool key1 = r <= a.r && (x - a.x) * (x - a.x) + (y - a.y) * (y - a.y) <= (a.r - r) * (a...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
#include <bits/stdc++.h> using namespace std; struct circle { int x, y, r, R; }; circle c[3]; int main(void) { for (int i = 1; i < 3; ++i) scanf("%d %d %d %d", &c[i].x, &c[i].y, &c[i].r, &c[i].R); double d = sqrt((double)(c[1].x - c[2].x) * (c[1].x - c[2].x) + (c[1].y - c[2].y) * (c[1].y - c...
CPP
199_B. Special Olympics
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two rings just fine. Let us remind you that a ring is a region located between two...
2
8
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solver { StringTokenizer st; BufferedReader in; PrintWriter out; public static void main(String[] args) throws NumberFormatException,...
JAVA