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 | import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import java.io.*;
import java.math.*;
import java.util.*;
@SuppressWarnings("unused")
public class B {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int x1 = 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;
bool check(double x, double x1, double y, double y1, double r, double r1,
double r2) {
if (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) <= r1 - r) return true;
if (sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) >= r + r2) return true;
if (sqrt((x - x1) ... | 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, y, r, R, ans;
struct cerc {
double x;
double y;
double raza;
} v[11];
double dist(double x_1, double y_1, double x_2, double y_2) {
return sqrt((x_1 - x_2) * (x_1 - x_2) + (y_1 - y_2) * (y_1 - y_2));
}
bool solve(cerc c1, cerc c2) {
if (c1.raza < c2.raza... | 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 dcmp(double a, double b) {
return fabs(a - b) <= 0.0000000001 ? 0 : (a > b) ? 1 : -1;
}
int main() {
int x1, y1, x2, y2, r1, r2, R1, R2;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
double dis = sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1));
int ... | 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>
const double pi = acos(-1.0);
double GetDis(double x1, double y1, double x2, double y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
double xx, yy, dis, EPS;
double x[2], y[2], r[2], R[2];
scanf("%lf%lf%lf%lf", &x[0], &y[0], &r[0], &R[0]);
scanf("%lf%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>
const int MAX = 300010;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-8;
const long double PI = acosl(-1.0);
using namespace std;
long double norm2(int a, int b) { return sqrtl(a * a + b * b); }
vector<int> vet;
lon... | 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 mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long INF = 1e18;
const long double EPS = 1e-12;
struct Point {
long double x, y;
Point() {}
Point(long double x, long double y) : x(x), y(y) {}
Point(const Point &p) : x(p.x), y(p.y) {}
Point operator+(co... | 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 a[4], b[4];
double sqr(double x) { return x * x; }
int eps(double x, double y) {
if (fabs(x - y) < 1e-8) return 0;
return x < y ? -1 : 1;
}
int solve(double a[], double b[]) {
double d = sqrt(sqr(a[0] - b[0]) + sqr(a[1] - b[1]));
int ret = 0;
if (eps(d + 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;
int Min(int x, int y) { return (x - y) * (x - y); }
int main() {
int x1, y1, x2, y2, R1, R2, r1, r2;
int z;
scanf("%d%d%d%d", &x1, &y1, &r1, &R1);
scanf("%d%d%d%d", &x2, &y2, &r2, &R2);
int ans = 0;
int l = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
if (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 | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x[] = new int [4];
int y[] = new int [4];
int r[] = new int [4];
x[0] = sc.nextInt();
y[0] = sc.nextInt();
r[0] = sc.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 | import java.util.*;
import java.math.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
Scanner c=new Scanner(System.in);
int x1=c.nextInt();
int y1=c.nextInt();
int r1=c.nextInt();
int R1=c.nextInt();
int x2=c.nextInt();
int y2=c.nextInt();
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;
bool 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))
return true;
return... | 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];
double dis(double a, double b, double c, double d) {
return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
int doit(int flag) {
double d = dis(x[flag], y[flag], x[!flag], y[!flag]);
double d1, d2;
int ans = 0;
if (r[flag] >= d + R[!f... | 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 next(int x) {
if (x & 1)
x = (x + 1) % 4;
else
x = (x + 2) % 4;
return x;
}
double dist(int x1, int y1, int x2, int y2) {
return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
int main() {
int r[4], x[4], y[4];
scanf("%d%d%d%d%d%d%d%d", &x[0], &y[0], &r[0], &r[1], &x[2], &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 | #------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
BUF... | 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 point {
double x, y;
point() { x = 0.0, y = 0.0; }
point(double _x, double _y) { x = _x, y = _y; }
bool operator<(point other) const {
if (fabs(x - other.x) > 1e-9) return x < other.x;
return y < other.y;
}
};
struct line {
double a, b, c;
line(... | 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 ans, x[2], y[2], r[2], R[2], t;
inline long long sq(long long x) { return x * x; }
int main() {
for (int i = 0; i < 2; i++)
scanf("%I64d%I64d%I64d%I64d", x + i, y + i, r + i, R + i);
t = sq(x[0] - x[1]) + sq(y[0] - y[1]);
for (int i = 0; i < 2; i++) {
... | 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;
int x2;
int y1;
int y2;
int r1;
int r2;
int R1;
int R2;
cin >> x1;
cin >> y1;
cin >> r1;
cin >> R1;
cin >> x2;
cin >> y2;
cin >> r2;
cin >> R2;
int p = 4;
float s = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (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 math
x1, y1, r1, R1 = map(int, raw_input().split())
x2, y2, r2, R2 = map(int, raw_input().split())
N = 10 ** 4
a = [r1, R1]
b = [r2, R2]
cnt = 0
pi = math.atan(1.0) * 4
cos = math.cos
sin = math.sin
eps = 1.0e-9
def dis(x1, y1, x2, y2):
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
for r in a:
f = 1
for i i... | 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;
double dis(double x1, double y1, double x2, double y2) {
double xx = x1 - x2, yy = y1 - y2;
return sqrt(xx * xx + yy * yy);
}
int can(double x1, double y1, double r1, double x2, double y2, double r2) {
double dst = dis(x1, y1, x2, y2);
if (dst + 1e-8 > r1 + r2) 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 | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-11;
const long long MOD = 1000000007;
const int N = 2e6 + 10;
void fast() { std::ios_base::sync_with_stdio(0); }
int main() {
int x1, y1, x2, y2, r1, R1, r2, R2, res = 0;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> 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 dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void PLAY() {
cout << fixed << setprecision(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>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
vector<i... | 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 B implements Runnable {
private void Solution() throws IOException {
int[][] r = new int[2][4];
for (int i = 0; i < 2; i++)
for (int j = 0; j ... | 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;
bool check(int x, int y, int r, int xx, int yy, int rr, int RR) {
int dr = r - rr;
int sr = r + rr;
int dx = x - xx;
int dy = y - yy;
int d2 = dx * dx + dy * dy;
int dR = r - RR;
int sR = r + RR;
if (r <= rr && d2 <= dr * dr) {
return true;
}
if (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 | x1, y1, r1, R1 = map(int, input().split())
x2, y2, r2, R2 = map(int, input().split())
D = (x1-x2)**2+(y1-y2)**2
c = 0
c += ((r1-r2)**2>=D)
c += ((R1-R2)**2>=D)
c += ((R1+r2)**2<=D)
c += ((R2+r1)**2<=D)
c += ((R1+R2)**2<=D)*2
if r1 >= R2:
c += ((r1-R2)**2>=D)*2
if r2 >= R1:
c += ((r2-R1)**2>=D)*2
print(c)
| 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 = 2.0 * acos(0.0);
const double EPS = 1e-6;
inline int DIST_POW(int x1, int y1, int x2, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
inline bool inside(pair<int, int> o1, pair<int, int> o2, int r1, int r2) {
int O1O2 = DIST_POW(o1.fi... | 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>
const int inf = (1ll << 30) - 1;
const int maxn = (int)1e5 + 10;
const int mod = (int)1e9 + 7;
using namespace std;
vector<pair<pair<int, int>, int> > v;
int calc(int r1, int x2, int y2, int r2) {
int a = -2 * x2;
int b = -2 * y2;
int c = x2 * x2 + y2 * y2 + r1 * r1 - r2 * r2;
if (c * 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 | ((x,y,r,R), (u,v,w,W))=[map(int, input().split()) for _ in range(2)]
d = (x-u) ** 2 + (y - v) ** 2
def t(a,b,c):
if c <= a and (a-c)**2 >= d:
return 1
if c >= b and (c-b)**2 >= d:
return 1
if (b+c) ** 2 <= d:
return 1
return 0
print(t(r,R,w) + t(r,R,W) + t(w,W,r) + t(w,W,R))
... | 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 | ((x,y,r,R),(u,v,w,W))=[map(int,raw_input().split()) for _ in (1,2)]
d=(x-u)*(x-u)+(y-v)*(y-v)
def t(a,b,c):
if c<=a and (a-c)*(a-c)>=d:return 1
if c>=b and (c-b)*(c-b)>=d:return 1
if (b+c)*(b+c)<=d:return 1
return 0
print t(r,R,w)+t(r,R,W)+t(w,W,r)+t(w,W,R)
# Made By Mostafa_Khaled | 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;
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 and l + R2 <= r1 or l > r1 and l - R2 >= r1 or 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 | '''
Created on 23.06.2012
@author: Admin
'''
import math
def is_in_range(x, r):
return x < r and x > -r
def calc_position (x1, x2, r):
dotyk = int(abs(x1) == abs(r)) + int (abs(x2) == abs(r))
inside = int(is_in_range(x1, r)) + int(is_in_range(x2, r))
outside = 2 - inside - dotyk
return [insi... | 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;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
double x1, y1, r1, R1, x2, y2, r2, R2;
cin >> x1 >> y1 >> r1 >> R1;
cin >> x2 >> y2 >> r2 >> R2;
int ans = 0;
double dx = (x1 - x2) * (x1 - x2);
double dy = (y1 - y2) * (y1 - y2);
double dist = sqrt(dx + dy... | 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.InputStreamReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solu... | 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.util.*;
public class Main{
public void run(){
Scanner in = new Scanner(System.in);
int x1 = in.nextInt();
int y1 = in.nextInt();
int r1 = in.nextInt();
int R1 = in.nextInt();
int x2 = in.nextInt();
int y2 = in.nextInt();
int r2 = in.nextInt();
int R2 = in.nextInt();
int ret = 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 d2;
pair<int, int> ok(int r1, int r2) {
if (d2 >= (r1 + r2) * (r1 + r2)) {
return make_pair(1, 0);
}
if (d2 <= (r2 - r1) * (r2 - r1)) {
return make_pair(1, 1);
}
return make_pair(0, 0);
}
int proc(int r1, int r2, int R2) {
int res = 0;
if (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 main() {
double ax, ay, ar, aR;
double bx, by, br, bR;
cin >> ax >> ay >> ar >> aR;
cin >> bx >> by >> br >> bR;
double d = sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
if (d + aR < br + (1e-8)) {
cout << 4 << endl;
} else if (d + bR < ar + (1e... | 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 math
def intersect(r1,R1,r):
global d
if d+r<=r1:
return 1
elif r+R1<=d:
return 1
elif d+R1<=r:
return 1
return 0
x1,y1,r1,R1=map(int,input().split())
x2,y2,r2,R2=map(int,input().split())
d=math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(intersect(r1,R1,r2)+intersect... | 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;
bool OK(double X, double Y, double R, double X0, double Y0, double r0,
double R0) {
double Dist = sqrt((X - X0) * (X - X0) + (Y - Y0) * (Y - Y0));
return fabs(Dist - R) >= R0 || Dist + R <= r0;
}
int main() {
double X0, Y0, r0, R0, X1, Y1, r1, R1;
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;
int x[4], y[4], r[4], ans;
inline int sqr(int a) { return a * a; }
int main() {
scanf("%d%d%d%d", x + 0, y + 0, r + 0, r + 1);
scanf("%d%d%d%d", x + 2, y + 2, r + 2, r + 3);
x[1] = x[0], y[1] = y[0];
x[3] = x[2], y[3] = y[2];
for (int i = 0; i < 4; i++) {
int ... | 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 distance_sq(double x1, double y1, double x2, double y2) {
double x3 = x2 - x1, y3 = y2 - y1;
return ((x3 * x3) + (y3 * y3));
}
int main(void) {
double x1, y1;
double x2, y2;
double r[4];
while (cin >> x1 >> y1 >> r[0] >> r[1] >> x2 >> y2 >> r[2] >> r[3]) ... | 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 math
x1, y1, ir1, er1 = map(int, raw_input().split())
x2, y2, ir2, er2 = map(int, raw_input().split())
def dis(x1, y1, x2, y2):
return math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))
def check(x1, y1, r1, x2, y2, r2):
if abs(r1-r2)>=dis(x1,y1,x2,y2) or dis(x1, y1, x2, y2)>=r1+r2:
return(1)
else:
return(0)... | 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 | import math
if __name__ == "__main__":
x1, y1, r1, R1 = map(int, raw_input().split())
x2, y2, r2, R2 = map(int, raw_input().split())
c = [(x1, y1, r1), (x1, y1, R1), (x2, y2, r2), (x2, y2, R2)]
def dist2(a, b):
return (a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2
def dist(a, b):
return... | 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 circle {
double x, y, r;
circle() { x = y = r = 0; }
circle(double a, double b, double c) {
x = a;
y = b;
r = c;
}
};
circle c[10];
int mark[105];
double dist(int a, int b) {
double x = c[a].x - c[b].x;
double y = c[a].y - c[b].y;
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 | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF199B extends PrintWriter {
CF199B() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF199B o = new CF199B(); o.main(); o.flush();
}
boolean disjoint(int x1, int y1, int r1, int x... | 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;
int check(double a, double b, double c) {
if (a + c <= d || a + d <= b || d + c <= a)
return 1;
else
return 0;
}
int main() {
double x1, y1, r1, R1;
cin >> x1 >> y1 >> r1 >> R1;
double x2, y2, r2, R2;
cin >> x2 >> y2 >> r2 >> R2;
d = sqrt((x1... | 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 n, i, x[2], y[2], r[2], R[2], combien = 0, d;
for (i = 0; i < 2; i++) {
scanf("%d %d %d %d\n", &x[i], &y[i], &r[i], &R[i]);
}
d = (x[1] - x[0]) * (x[1] - x[0]) + (y[1] - y[0]) * (y[1] - y[0]);
if (r[0] * r[0] <= d) {
if ((R[1] + r[0]) * (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;
int s(int x) { return x * x; }
int main() {
int x1, y1, r1, R1, x2, y2, r2, R2;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
int T = 0;
if (r1 < r2) {
swap(r1, r2);
swap(R1, R2);
}
int D = s(x1 - x2) + s(y1 - y2);
if (s(r1 + R2) <= D)
++T;
... | 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 B {
static Scanner scan = new Scanner (System.in);
static PrintStream out = System.out;
static int x1, y1, r1, R1, x2, y2, r2, R2;
static int distP () {
return (x1 - x2)*(x1 - x2)+(y1-y2)*(y1-y2);
}
static int check2C (int ra, 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 | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long double dist(long long x, long long y) { return sqrt(x * x + y * y); }
bool good(long double d, long double r, long double r1, long double R1) {
if (d + r <= r1) return 1;
if (d >= r + R1) return 1;
if (d + R1 <= r) return 1;
return 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 xa, ya, ra, Ra;
double x2, y2, r2, R2;
double sqr(double x) { return (x) * (x); }
double dis(double x1, double y1, double x2, double y2) {
return sqrt(sqr(x1 - x2) + sqr(y1 - y2));
}
int main() {
scanf("%lf%lf%lf%lf", &xa, &ya, &ra, &Ra);
scanf("%lf%lf%lf%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;
int const N = 101;
long long const INF = 1 << 30;
double eps = 1.0e-8;
const double pai = acos(-1.0);
const double g = 9.87;
double x1, yy1, r1, R1;
double x2, y2, r2, R2;
double f(double x) { return x * x; }
int main() {
cin >> x1 >> yy1 >> r1 >> R1 >> x2 >> y2 >> 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;
typedef struct {
int x, y, r;
} Node;
int cross(Node a, Node b) {
int dis = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
if (dis >= (a.r + b.r) * (a.r + b.r))
return 0;
else if ((a.r - b.r) * (a.r - b.r) >= dis)
return 2;
else
return 1;
}
int... | 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;
void read() { scanf("%lf %lf", &x, &y); }
} c[4];
double dist;
int CIRxCIR(const Circle &c1, const Circle &c2) {
if (dist > c1.r + c2.r) {
return 0;
} else if (dist == c1.r + c2.r) {
return 1;
} else if (dist < fabs(c1.r - c2.r)) {
return 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;
int main() {
int x1, x2, y1, y2, r1, r2, s1, s2, ans = 0;
double t;
cin >> x1 >> y1 >> r1 >> s1;
cin >> x2 >> y2 >> r2 >> s2;
t = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (t * t >= (r1 + s2) * (r1 + s2) || (t + r1) * (t + r1) <= r2 * 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;
#pragma GCC optimize("O3")
const long long int mod = 1e18 + 7;
long long int powmod(long long int x, long long int y) {
long long int t;
for (t = 1; y; y >>= 1, x = x * x % mod)
if (y & 1) t = t * x % mod;
return t;
}
long long int gcd(long long int x, long long i... | 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 intersect(double r1, double r2, double dist) {
if (dist + 1e-9 >= r1 + r2 || dist + r1 - 1e-9 < r2 || dist + r2 - 1e-9 < r1)
return false;
return true;
}
int main() {
double a, b, x, y, r1, r2, p1, p2;
cin >> a >> b >> r1 >> r2 >> x >> y >> p1 >> p2;
doub... | 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 SQR(int tmp) { return tmp * tmp; }
int main() {
int x[2], y[2], r[2], R[2];
for (int i = 0; i <= 1; i++) scanf("%d%d%d%d", &x[i], &y[i], &r[i], &R[i]);
int ans = 0;
for (int i = 0; i <= 1; i++) {
if (r[i] < r[!i] &&
SQR(x[i] - x[!i]) + SQR(y[i] - 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 | x1,y1,r1,R1=map(int,raw_input().split())
x2,y2,r2,R2=map(int,raw_input().split())
def ok(x,y,r,X,Y,R):
return (X-x)**2+(Y-y)**2>=(R+r)**2 or (X-x)**2+(Y-y)**2<=(R-r)**2
def between(x,y,x1,y1,r,R):
d = (x-x1)**2+(y-y1)**2
return r*r<=d<=R*R
def solve(x1,y1,r1,x2,y2,r,R):
if not ok(x1,y1,r1,x2,y2,r) or no... | 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;
int main() {
int x1, x2, y1, y2, r1, r2, R1, R2, count = 0;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
double dist = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (dist >= R1 + R2 || dist <= r2 - R1 || dist <= R1 - R2) count++;
if (dist >= 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[10], y[10], r[10];
bool s[10];
int main() {
memset(s, 0, sizeof(s));
scanf("%d%d%d%d", &x[1], &y[1], &r[1], &r[2]);
scanf("%d%d%d%d", &x[3], &y[3], &r[3], &r[4]);
x[2] = x[1];
x[4] = x[3];
y[2] = y[1];
y[4] = y[3];
int ans = 0;
for (int i = 1; i <= 4... | 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[2], y[2], r[2], R[2];
bool pr;
int s, ans = 0;
int sqr(int x) { return x * x; }
bool t(int r, int R) { return sqr(r - R) >= s || sqr(r + R) <= s; }
int main() {
for (int i = 0; i < 2; ++i) cin >> x[i] >> y[i] >> r[i] >> R[i];
s = sqr(x[0] - x[1]) + sqr(y[0] - y[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 | def intersect(r,r2,R2,x,y,x2,y2):
sd = (x-x2)**2 + (y-y2)**2
return 1 if sd >= (r+R2)**2 or r<r2 and sd<=(r2-r)**2 or R2<r and sd<=(r-R2)**2 else 0
x1,y1,r1,R1 = map(int, raw_input().split())
x2,y2,r2,R2 = map(int, raw_input().split())
print intersect(r1,r2,R2,x1,y1,x2,y2) + intersect(R1,r2,R2,x1,y1,x2,y2)+... | 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 | import math
x1, y1, r1, R1 = [int(i) for i in raw_input().split(' ')]
x2, y2, r2, R2 = [int(i) for i in raw_input().split(' ')]
d = math.sqrt((x1-x2)**2+(y1-y2)**2)
s = 0
f = lambda r1, r2, R2: (r1 + R2 <= d) or ((abs(r1 - r2) >= d) and ((r1 <= r2) or ((r1 >= R2) and abs(r1 - R2) >= d)))
if f(r1, r2, R2):
s+=1
if ... | 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;
int main() {
double x1, y1, r1, R1, x2, y2, r2, R2;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
int say = 0;
double mesafe = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
if (mesafe + r1 <= r2 || mesafe + R2 <= r1 || mesafe >= r1 + R2) {
++say;
}
if (m... | 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 | ((x,y,r,R),(u,v,w,W))=[map(int,raw_input().split()) for _ in (1,2)]
d=(x-u)*(x-u)+(y-v)*(y-v)
def t(a,b,c):
if c<=a and (a-c)*(a-c)>=d:return 1
if c>=b and (c-b)*(c-b)>=d:return 1
if (b+c)*(b+c)<=d:return 1
return 0
print t(r,R,w)+t(r,R,W)+t(w,W,r)+t(w,W,R)
| 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 int MAX = 100 * 1000;
const int INF = 1 << 29;
const long long D = 1000 * 1000 * 1000 + 7;
int n;
pair<int, int> c[2];
int r[2][2];
int sqr(int a) { return a * a; }
int main() {
ios::sync_with_stdio(false);
for (int i = 0; i < 2; i++)
cin >> c[i].first >> c[i]... | 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-6;
double X[55], Y[55], R[55];
double sqr(double x) { return x * x; }
int sign(double x) { return x < -EPS ? -1 : x > EPS; }
bool inside(int i, int j) {
double d = sqrt(sqr(X[i] - X[j]) + sqr(Y[i] - Y[j]));
if (sign(R[i] - R[j]) <= 0) return sign(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 | import java.util.Scanner;
public class SpecialOlympics {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] r, x, y;
r = new int[4]; x = new int[4]; y = new int[4];
x[0] = x[1] = sc.nextInt();
y[0] = y[1] = sc.nextInt();
r[0] = sc.nex... | 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;
using LL = long long;
int x[2], y[2], r[2], R[2];
int s(int a) { return a * a; }
bool chk(int r, int r1, int R1, int d) {
if (sqrt(d) + r <= r1) return true;
if (r + R1 <= sqrt(d)) return true;
if (sqrt(d) + R1 <= r) return true;
return false;
}
int main() {
for (... | 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];
long long hypot2(long long x, long long y) { return x * x + y * y; }
long long square(long long x) { return x * x; }
bool inter(int i, int j) {
long long d2 = hypot2(X[i] - X[j], Y[i] - Y[j]);
if (d2 >= square(R[i] + R[j])) return false;
if (R[i]... | 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 long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
pair<int, int> c1, c2, r1, r2;
int ans = 0;
long double dst(pair<int, int> a, pair<int, int> b) {
return (a.first - b.first) * (a.first - b.first) +
(a.second - b.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;
struct ring {
int x, y, r, R;
} a, b;
inline int sq(int x) { return x * x; }
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> a.x >> a.y >> a.r >> a.R;
cin >> b.x >> b.y >> b.r >> b.R;
int cdist = sq(a.x - b.x) + sq(a.y - b.y), cnt = 0;
if (cdist <= sq(a.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;
int x1, x2, Y1, Y2, r1, R1, r2, R2;
double dc;
int comp(double x, double y) {
if (x > y + 1e-9) return 1;
if (x < y - 1e-9)
return -1;
else
return 0;
}
bool contenida(int a, int b) {
dc = sqrt((x1 - x2) * (x1 - x2) + (Y1 - Y2) * (Y1 - Y2));
if (dc + a <= b... | 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 {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int oo = (int)1e9;
// static long oo = (long)1e15;
static int mod = 1_000_000_007;
static int[] di = {1, 0, 0, -1};
static int[] dj... | 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;
const double EPS = 1e-7;
const double MUL_EPS = 1 + EPS;
const double PI = acos(-1);
struct Point {
double x, y;
Point() {}
Point(double x, double y) : x(x), y(y) {}
Point(const Point &p) : x(p.x), y(p.y) {}
Point operator+(const Point &p) const { return Point(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 math
def in_circ(r1, dist, r2):
return math.fabs(dist - r2) <= r1 and dist + r2 <= r1
def out_circ(r1, dist, r2):
return math.fabs(dist - r2) >= r1 and dist + r2 >= r1
def solve():
first = raw_input().split()
second = raw_input().split()
x1 = int(first[0])
y1 = int(first[1])
r1 = int(first[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 | #include <bits/stdc++.h>
using namespace std;
double len(int x1, int stupid_cmath, int x2, int y2) {
return sqrt(0.0 + ((x1 - x2) * (x1 - x2)) +
((stupid_cmath - y2) * (stupid_cmath - y2)));
}
int main() {
int a, b, c, d, mm[4][3], i, j;
double l;
cin >> a >> b >> c >> d;
mm[0][0] = a;
mm[0][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>
using namespace std;
int sq(int a) { return a * a; }
int dis(int x1, int y1, int x2, int y2) { return sq(x2 - x1) + sq(y2 - y1); }
int check(int d, int r, int r1, int r2) {
if (d >= sq(r + r2)) return 1;
if (r <= r1 && d <= sq(r - r1)) return 1;
if (r >= r2 && d <= sq(r - r2)) 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 sys
stderr = sys.stderr
def nums():
return map(int, raw_input().split())
X, Y, R1, R2 = 0, 1, 2, 3
c1 = nums()
c2 = nums()
def dist(x1, y1, x2, y2):
return ((x1-x2)**2 + (y1 - y2)**2)**.5
def cok(x, y, r, c):
d = dist(x, y, c[X], c[Y])
# print 'd >= r + c[R2] or d + r <= c[R1] or d + c[R2] <= r:'... | 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;
complex<int> O[4];
int r[4];
int main() {
for (int i = 0; i < 2; ++i) {
int x, y, r1, r2;
scanf("%d%d%d%d", &x, &y, &r1, &r2);
O[2 * i] = complex<int>(x, y);
O[2 * i + 1] = complex<int>(x, y);
r[2 * i] = r1;
r[2 * i + 1] = r2;
}
int ans = 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;
bool totC(int x1, int y1, int r1, int x2, int y2, int r2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) <= (r1 - r2) * (r1 - r2);
}
bool apart(int x1, int y1, int r1, int x2, int y2, int r2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) >= (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;
const double PI = 3.1415926535;
double squared(double n) { return n * n; }
typedef struct {
int cx;
int cy;
int r;
int R;
} circle_t;
bool isBlack(double x, double y, circle_t c) {
double val = squared(x - (double)c.cx) + squared(y - (double)c.cy);
if (val > squ... | 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 EP = 1e-8;
struct circle_t {
double x, y;
double r;
};
struct point_t {
double x, y;
};
inline double dist(double x1, double y1, double x2, double y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
double sqr(double a) { return a * 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;
int main() {
int x1, x2, y1, y2, d;
int r11, r12, r21, r22;
int d11, d12, d21, d22;
int D11, D12, D21, D22;
while (cin >> x1 >> y1 >> r11 >> r12 >> x2 >> y2 >> r21 >> r22) {
d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
d11 = abs(r11 - r21);
d12 =... | 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 inters(long ra, long rb, long dr) {
return dr > (ra - rb) * (ra - rb) && dr < (ra + rb) * (ra + rb);
}
bool lay(long ra, long Ra, long rb, long dr) {
return ra < rb && rb < Ra && dr <= (rb - ra) * (rb - ra) &&
dr <= (Ra - rb) * (Ra - rb);
}
bool flay(long ra, long Ra, long rb,... | 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 bool Up(T &a, const T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
template <class T>
inline bool Down(T &a, const T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
inline int getus() {
int tmp, 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;
struct no {
int x, y, r;
};
no A, B, b, a;
int dist(no u, no v) {
return (u.x - v.x) * (u.x - v.x) + (u.y - v.y) * (u.y - v.y);
}
bool contido(no v, no u) {
if (u.r < v.r) return 0;
if ((sqrt(dist(v, u)) + (double)((v.r)) - 1e-2 < (double)(u.r))) return 1;
return ... | 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 | EPSILON = 0.000000001
def intersect(x1,y1,r1,x2,y2,r2):
global d
if r1>r2:
r1,r2 = r2,r1
x1,x2 = x2,x1
y1,y2 = y2,y1
if abs(d-r2)<EPSILON:
return True
elif d<r2:
return r1>r2-d
else:
return d<r1+r2
#data = open("P2.txt")
x1,y1,r1,r2 = map(int... | 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;
int main() {
double x[2], y[2], r[2], R[2];
int i;
for (i = 0; i < 2; ++i) cin >> x[i] >> y[i] >> r[i] >> R[i];
double dx = x[0] - x[1], dy = y[0] - y[1];
double d = sqrt(dx * dx + dy * dy);
int cnt = 0;
for (i = 0; i < 2; ++i) {
int cur = i, oth = 1 - i;
... | 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.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) throws IOException {
(new Main()).solve();
}
public void Main() {
}
void solve() throws IOException {
// BufferedReader in = new BufferedReader(new
// I... | 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;
const double EPS = 1e-10;
bool operator<(const complex<double>& a, const complex<double>& b) {
return abs(a) < abs(b);
}
struct Circle {
complex<double> p;
double r;
Circle(complex<double> p, double r) : p(p), r(r) {}
};
bool dbgte(double a, double b) { return a - b... | 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 Main {
private static int[] crosses = new int[4];
private static int[][] circles = new int[4][3];
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int x = sc.nextInt();
int y = sc.nextInt();
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 | from sys import stdin
in_lines = stdin.readlines()
def int_values(line) :
return map( int, line.split(' ') )
lines = map( int_values, map( lambda x:x.strip(), in_lines ) )
x1, y1, r1, R1 = map( lambda x: x * 1000, lines[0] )
x2, y2, r2, R2 = map( lambda x: x * 1000, lines[1] )
circles = [ (x1, y1, r1), (x1, y... | 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;
int main() {
int x1, y1, r1, R1;
int x2, y2, r2, R2;
while (cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2) {
double d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
int ans = 0;
if (d >= r1 + R2 || d <= r2 - r1 || d <= r1 - R2) ans++;
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>
int main() {
std::array<int, 4> c[2];
int r(0);
double d;
for (int i(0); i < 2; ++i)
std::scanf("%d%d%d%d", &c[i][0], &c[i][1], &c[i][2], &c[i][3]);
d = std::sqrt((c[0][0] - c[1][0]) * (c[0][0] - c[1][0]) +
(c[0][1] - c[1][1]) * (c[0][1] - c[1][1]));
if (c[0][3] ... | 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.text.*;
import java.util.*;
import java.math.*;
public class B {
static boolean intersect(int x1, int y1, int x2, int y2, int r1, int r2) {
double d = Math.sqrt((y2- y1) * (y2- y1) + (x2 - x1) * (x2 - x1));
if(d >= r2 + r1 || d <= Math.abs(r2 - r1))
return false;
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;
struct krug {
long long x, y, r, R;
krug() {
x = 0;
y = 0;
r = 0;
R = 0;
}
int check(krug a, long long r1) {
if (((((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y))) <=
((r - r1) * (r - r1))) &&
(r >= r1))
return 1;
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;
struct point {
double x, y;
point() : x(0), y(0) {}
point(double _x, double _y) : x(_x), y(_y) {}
point operator+(point other) { return point(x + other.x, y + other.y); }
point operator-(point other) { return point(x - other.x, y - other.y); }
};
double dot(point ... | 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.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Enumeration;
impor... | JAVA |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.