prompt string | response string |
|---|---|
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int go(double a1, double b1, double r1, double a2, double b2, double r2,
double l2) {
double d = sqrt(((a1 - a2) * (a1 - a2)) + ((b1 - b2) * (b1 - b2)));
if (d >= r1 + l2) return 1;
if (d + r1 <= r2) return 1;
if (d + l2 <= r1) return 1;
return 0;
}
double ... |
Problem: 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 be... | def okay(xc, yc, rc, xr, yr, rr, Rr):
d = ((xc-xr) ** 2 + (yc-yr) ** 2) ** 0.5
if d + rc <= rr:
return True
if d >= rc + Rr:
return True
if d + Rr <= rc:
return True
return False
x1, y1, r1, R1 = map(float, input().split())
x2, y2, r2, R2 = map(float, input().split())
ans = ... |
Problem: 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 be... | import java.util.Scanner;
import java.io.PrintWriter;
public class Main {
private static boolean isGoodRing(int distanceSqr, int r, int innerR, int outerR) {
if (distanceSqr >= sqr( outerR + r ) ) {
return true;
} else if (innerR > r && distanceSqr <= sqr( innerR - r) ) {
return true;
} else if (r >= out... |
Problem: 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 be... | #include <bits/stdc++.h>
int main() {
int x1, y1, r1, R1, x2, y2, r2, R2, d, sum = 0;
scanf("%d %d %d %d", &x1, &y1, &r1, &R1);
scanf("%d %d %d %d", &x2, &y2, &r2, &R2);
d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
if (d >= r1 * r1) {
if (r2 >= r1 && d <= r1 * r1 - 2 * r1 * r2 + r2 * r2) {
sum... |
Problem: 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 be... | #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... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int xa, ya, ra, Ra;
int xb, yb, rb, Rb;
double ioi;
int ans;
double mn, mx;
double dst() { return sqrt((xa - xb) * (xa - xb) + (ya - yb) * (ya - yb)); }
int dnt(int a, int b) {
double sum = double(a + b);
if (sum <= ioi)
return 3;
else {
mn = double(min(a, b))... |
Problem: 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 be... | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;
public class B
{
BufferedReader in;
PrintStream out;
StringTokenizer tok;
public B() throws NumberFormatException, IOException
{
in = new Buffe... |
Problem: 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 be... | #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 ... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
double xa, ya, la, ra, xb, yb, lb, rb, d;
bool qwq(double x, double y, double z) {
if (x + d <= y || d >= x + z || d + z <= x) return 1;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> xa >> ya >> la >> ra;
cin >> xb >> yb >> lb >> rb;
... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
template <class T>
void _R(T &x) {
cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class ... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 5;
const int INF = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = 3.1415926535897932384626433832795;
int main() {
ios_base::sync_with_stdio(0);
int x1, x2, y1, y2, r1, R1, r2, R2;
cin >> x1 >> y1 >> r1 >> R1;
cin >> x2 >> y2 >> r2 ... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 6e5 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
double x[3], y[3], r[3], R[3], d;
long long Ways;
int32_t main() {
ios::sync_with_stdio(... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int check(int r1, int r2, int dd) {
int rr = (r1 + r2) * (r1 + r2);
if (rr <= dd) return 1;
if (r1 >= r2) {
rr = (r1 - r2) * (r1 - r2);
if (rr >= dd) return 1;
}
if (r1 <= r2) {
rr = (r1 - r2) * (r1 - r2);
if (rr >= dd) return -1;
}
return 0;
}... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int x[2], y[2], r[2], R[2];
int ans;
double d;
bool include(int r1, int r2) {
if (r2 >= r1) return false;
return d <= r1 - r2;
}
bool outer(int r1, int r2) { return d >= r1 + r2; }
int main() {
for (int i = 0; i < 2; i++) cin >> x[i] >> y[i] >> r[i] >> R[i];
d = sqr... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct circ {
int x, y, r;
};
circ arr[5];
double dis(int x, int y, int xx, int yy) {
return (x - xx) * (x - xx) + (y - yy) * (y - yy);
}
bool inter(int a, int b) {
double dist = sqrt(dis(arr[a].x, arr[a].y, arr[b].x, arr[b].y));
if (arr[a].r + arr[b + 1].r <= dist)... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int iabs(int x) { return (x > 0) ? x : -x; }
int sqr(int x) { return x * x; }
bool cross(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
int d = sqr(x1 - x2) + sqr(y1 - y2);
if ((r1 > R2) && (d <= sqr(iabs(r1 - R2)))) return true;
if ((r1 < r2) && (d <= sqr(... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct circle {
int x, y, r;
};
int x[2], y[2], r1[2], r2[2];
int sqr(int x) { return x * x; }
bool inside(circle c1, circle c2) {
if (sqr(c1.x - c2.x) + sqr(c2.y - c1.y) <= sqr(c1.r - c2.r) && c2.r >= c1.r) {
return 1;
}
return 0;
}
bool inter(circle c1, circle... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
inline double sqr(double x) { return x * x; }
struct point {
double x, y;
inline void scan() { scanf("%lf%lf", &x, &y); }
};
inline double dispoint(point a, point b) {
return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}
struct cir {
point o;
double r;
};
struct ring {... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct circle {
int x, y, r, R;
} c[2];
int ans;
double dis;
void check(circle a, circle b) {
if (a.r + b.R <= dis || b.r - a.r >= dis || a.r - b.R >= dis) ++ans;
if (a.R + b.R <= dis || b.r - a.R >= dis || a.R - b.R >= dis) ++ans;
}
int main() {
while (cin >> c[0].... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
bool inside(double d, int r1, int r2) { return (d + r1 <= r2 + eps); }
bool outside(double d, int r1, int r2) {
if (d >= r1 + r2 - eps) return true;
return inside(d, r2, r1);
}
int main() {
ios_base::sync_with_stdio(false);
int x1, y1, r1, R... |
Problem: 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 be... | #include <bits/stdc++.h>
int correct(double dist, int r, int r1, int r2) {
if (dist + r <= r1 || dist >= r + r2 || dist + r2 <= r) {
return 1;
} else {
return 0;
}
}
int main() {
int x1, y1, r1, R1, x2, y2, r2, R2;
scanf("%d %d %d %d", &x1, &y1, &r1, &R1);
scanf("%d %d %d %d", &x2, &y2, &r2, &R2);
... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
double d;
bool can(int r, int r1, int R1) {
return r + d <= r1 || r + R1 <= d || d + R1 <= r;
}
int main() {
ios_base ::sync_with_stdio(false);
cin.tie(NULL);
int x1, y1, r1, R1, x2, y2, r2, R2;
cin >> x1 >> y1 >> r1 >> R1;
cin >> x2 >> y2 >> r2 >> R2;
d = sqr... |
Problem: 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 be... | #include <bits/stdc++.h>
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;
}
int main() {
ios::sync... |
Problem: 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 be... | #include <bits/stdc++.h>
std::mt19937 rng(
(int)std::chrono::steady_clock::now().time_since_epoch().count());
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
int x[2], y[2], r[2], R[2];
for (int i = 0; i < 2; i++) {
std::cin >> x[i] >> y[i] >> r[i] >> R[i];
}
int dx = x[0] - ... |
Problem: 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 be... |
def within(a,b, c):
return c>=a and c<=b
def isoverlap(diff, R1, r1, r2):
if within(-r1,r1,diff-r2) and within (-r1,r1,diff+r2):
return False
if diff-r2<=-R1 and diff+r2>=R1:
return False
if diff+r2<=-R1:
return False
if diff-r2>=R1:
return False
return True
x1... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
typedef struct {
int x, y, r;
} circle;
int notinter(circle a, circle b) {
long double dist =
sqrt(pow(1.0 * (b.x - a.x), 2) + pow(1.0 * (b.y - a.y), 2));
if (dist >= a.r + b.r)
return 1;
else if (dist <= abs(a.r - b.r))
return -1 - (a.r > b.r);
else... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
long double dist(int x1, int y1, int x2, int y2) {
return sqrtl((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
int x1, y1, r1, R1, x2, y2, r2, R2;
cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2;
int ans = 0;
long double x = dist(x1, y1, x2, y2... |
Problem: 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 be... | import java.io.*;
import java.util.*;
public class Main {
static int N, dp[][][], time[], f[], d[], t[], ans[];
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x1 = input.nextInt();
int y1 = input.nextInt();
int r11 = input.nextInt();... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
bool check(double d, double r, double r1, double R1) {
if (R1 <= d) {
return (r <= d - R1) or (d + R1 <= r);
} else if (r1 < d and d < R1) {
return (d + R1 <= r);
} else if (d <= r1) {
return (r <= r1 - d) or (d + R1 <= r);
} else
assert(false);
}
in... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
double EPS = 1e-10;
double EQ(double a, double b) { return abs(a - b) < EPS; }
void fast_stream() { std::ios_base::sync_with_stdio(0); }
int xs[4];
int ys[4];
int rs[4];
int Rs[4];
void solve() {
for (int i = 0; i < 2; i++) {
cin >> xs[i * 2] >> ys[i * 2] >> rs[i * 2]... |
Problem: 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 be... | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class C
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
void openInput(String file)
{
if(file==null)is = new BufferedReader(new InputStreamReader(System... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct cir {
double x, y, r, R;
} a, b;
double dis;
int check(cir a, cir b) {
int t = 0;
if (dis + a.R <= b.r || dis >= a.R + b.R || dis + b.R <= a.R) t += 1;
if (dis + a.r <= b.r || dis >= a.r + b.R || dis + b.R <= a.r) t += 1;
return t;
}
int main() {
cin >> a... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int inf_int = 2e9;
long long inf_ll = 2e18;
const double pi = 3.1415926535898;
template <typename T>
void prin(vector<T>& a) {
for (int i = 0; i < a.size(); i++) {
cout << a[i];
if (i < a.size() - 1)
cout << " ";
else
cout << "\n";
}
}
template <... |
Problem: 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 be... | import java.io.*;
import java.util.*;
public class Main {
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws Exception {
int x = sc.nextInt(), y = sc.nextInt(), ans = 0;
Circle a = new Circle(x,y, sc.nextInt()), b = ne... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct abc {
int x, y, r;
} c[4];
int u[4];
bool pdin(abc a, abc b) {
if (a.r > b.r) return false;
double d = ((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y));
if (d <= ((a.r - b.r) * (a.r - b.r))) return true;
return false;
}
bool cmp(abc a, abc b) {
d... |
Problem: 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 be... | #include <bits/stdc++.h>
int cal1(int x1, int x2, int y1, int y2, int r1, int r2, int r3) {
double dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (dis <= r2 - r1) {
return 1;
}
if (dis <= r1 - r3) {
return 1;
}
if (dis >= r3 + r1) {
return 1;
}
return 0;
}
int cal2(int x1, int... |
Problem: 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 be... | import java.io.*;
import java.util.*;
public class a {
static double EPS = 1e-9;
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int x1 = input.nextInt(), y1 = input.nextInt(), r1 = input.nextInt(), R1 = input.nextInt();
int x2 = inp... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct point {
int x, y;
};
point a, b;
double d(point a, point b) {
return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int ok1(int ra, int rb) {
double t = d(a, b);
int t1 = ra - rb;
if (t1 < 0) return 0;
if (t - t1 < 1E-6)
return 1;
el... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int Dl(int x1, int y1, int x2, int y2) {
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
bool Ok(int X, int Y, int R, int x, int y, int r1, int r2) {
int odl = Dl(X, Y, x, y);
return ((odl <= (r1 - R) * (r1 - R) && R < r1) ||
odl >= (r2 + R) * (r2 + ... |
Problem: 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 be... | #include <bits/stdc++.h>
int sqr(int a) { return a * a; }
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 h = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
printf("%d", (h + r1 <= r2 || r1 + R2 <= h || h + R2 <= r1) +
(h +... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int main() {
int r1, r2, r3, r4;
int c1x, c1y, c2x, c2y;
int ans = 0;
cin >> c1x >> c1y >> r1 >> r2;
cin >> c2x >> c2y >> r3 >> r4;
if ((r1 + r3) <=
(double)((sqrt((c1x - c2x) * (c1x - c2x) + (c1y - c2y) * (c1y - c2y))))) {
if ((r1 + r4) <=
(do... |
Problem: 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 be... | import java.util.*; import java.text.*; import java.io.BufferedReader;import java.math.*; import java.util.regex.*; import java.awt.geom.*; import static java.lang.Math.*; import static java.lang.Character.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import sta... |
Problem: 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 be... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:25600000")
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int INF = 1000000000;
bool check(int x, int y, int r, int x1, int y1, int r1, int R1) {
double dist = sqrt(1.0 * ((x - x1) * (x - x1) + (y - y1) * (y - y1)));
if (dis... |
Problem: 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 be... | 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... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int main() {
double x1, y1, x2, y2;
double r1, R1, r2, R2;
cin >> x1 >> y1 >> r1 >> R1;
cin >> x2 >> y2 >> r2 >> R2;
int sum = 0;
double L1 = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (L1 >= (r1 + R2)) sum++;
if (r2 >= r1 && (L1 <= (r2 - r1))) ... |
Problem: 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 be... | import java.util.Scanner;
public class ProblemB {
private static boolean notIntersect(double dist, int r1, int r2) {
if (dist >= r1 + r2)
return true;
if (dist + Math.min(r1, r2) <= Math.max(r1, r2))
return true;
return false;
}
public static void main(Stri... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline T cAbs(T x) {
if (x < 0) return -x;
return x;
}
template <class T>
inline T cMax(T a, T b) {
return a > b ? a : b;
}
template <class T>
inline T cMin(T a, T b) {
return a < b ? a : b;
}
bool chk(int x, int y, int r, int _x, int _y, int _r) ... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
double dist;
struct circle {
double x, y, r, R;
} a, b;
int alg(circle a, circle b) {
int t = 0;
if (dist >= a.R + b.R || dist + a.R <= b.r || dist + b.R <= a.R) t++;
if (dist >= a.r + b.R || dist + a.r <= b.r || dist + b.R <= a.r) t++;
return t;
}
int main() {
... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int x[2], y[2], r[2], R[2];
int cross(int x1, int y1, int r1, int x2, int y2, int r2) {
double dis = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
if (dis >= r1 + r2) return 1;
if (dis <= fabs(r1 - r2)) return r1 >= r2 ? 1 : -1;
return 0;
}
int main() {
for... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
bool amr_mora = false;
bool intersect(pair<long long, long long> c1, long long r1,
pair<long long, long long> c2, long long r2) {
long long d = (c1.first - c2.first) * (c1.first - c2.first);
d += (c1.second - c2.second) * (c1.secon... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
bool check(int x1, int y1, int r1, int x2, int y2, int r2, int R2) {
int l = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
int rr1 = (r1 - r2) * (r1 - r2);
int rr2 = (r1 + r2) * (r1 + r2);
int RR1 = (r1 - R2) * (r1 - R2);
int RR2 = (r1 + R2) * (r1 + R2);
if (l ... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct circle {
double x, y, r;
} a[5];
double dis;
double sqr(double a) { return a * a; }
bool cut(circle a, circle b) {
dis = sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
if (a.r > b.r) swap(a, b);
if (dis >= a.r + b.r) return false;
if (dis + a.r <= b.r) return false... |
Problem: 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 be... | #include <bits/stdc++.h>
double dis(int x1, int y1, int x2, int y2) {
int res = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
double l = sqrt(double(res));
return l;
}
bool check(int R, int r1, int r2, double l) {
if (l >= R + r2 || l + R <= r1 || R - l >= r2)
return true;
else
return false;
}
int ma... |
Problem: 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 be... | 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, y2, r2, R2) + cr... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
namespace Fast_IO {
const int MAXL((1 << 18) + 1);
int iof, iotp;
char ioif[MAXL], *ioiS, *ioiT, ioof[MAXL],
*iooS = ioof, *iooT = ioof + MAXL - 1, ioc, iost[55];
char Getchar() {
if (ioiS == ioiT) {
ioiS = ioif;
ioiT = ioiS + fread(ioif, 1, MAXL, stdin);
... |
Problem: 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 be... | #include <bits/stdc++.h>
int d2;
int relation(int r1, int r2) {
if (d2 <= (r1 - r2) * (r1 - r2)) {
if (r1 > r2)
return 1;
else
return -1;
} else if (d2 >= (r1 + r2) * (r1 + r2))
return 2;
else
return 0;
}
int main() {
int x[2], y[2], r[2], R[2];
for (int i = 0; i < 2; i++) scanf("%... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int cal(float x1, float y1, float r1, float R1, float x2, float y2, float r2,
float R2) {
float dis = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
dis = sqrt(dis);
int count = 0;
if (dis <= r1) {
if (((R2 + dis) <= r1) || (r2 >= (dis + r1))) count++;
... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 6e5 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
double x[3], y[3], r[3], R[3], d;
long long Ways;
int32_t main() {
ios::sync_with_stdio(... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
const int M = 1000 + 10;
int fun(int x1, int y1, int r1, int x2, int y2, int r2) {
int d2 = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
int rsum = r1 + r2;
int rdif = r1 - r2;
if (rdif < 0) {
rdif = -rdif;
}
if (d2 >= (r1 + r2) * (r1 + r2)) {
return 1... |
Problem: 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 be... | #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++;
e... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
double d(pair<int, int> a, pair<int, int> b) {
return sqrt((1.0 * a.first - b.first) * (1.0 * a.first - b.first) +
(1.0 * a.second - b.second) * (1.0 * a.second - b.second));
}
int main() {
pair<int, int> a, b;
int r1, r2, R1, R2;
while (cin >> a.first... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (!b) return a;
return gcd(b, a % b);
}
struct point {
int x, y;
};
struct ring {
point c;
int r, R;
} r1, r2;
int intersect(int x1, int y1, int r1, int x2, int y2, int r2) {
int d_sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
i... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
int sgn(double x) { return x < -1e-7 ? -1 : x > 1e-7; }
int x[2], y[2], r[2][2];
int ck(int i, int j) {
int k = i ^ 1;
double dis =
sqrt(((x[i] - x[k]) * (x[i] - x[k])) + ((y[i] - y[k]) * (y[i] - y[k])));
return sgn(dis - (r[i][j] - r[k][1])) <= 0 ||
sg... |
Problem: 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 be... | #include <bits/stdc++.h>
using namespace std;
struct RING {
int x, y, R;
bool b;
} ring[4];
int main() {
int x, y, r, R;
cin >> x >> y >> r >> R;
ring[0].x = ring[1].x = x;
ring[0].y = ring[1].y = y;
ring[0].R = r;
ring[1].R = R;
cin >> x >> y >> r >> R;
ring[2].x = ring[3].x = x;
ring[2].y = ring... |
Problem: 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 be... | #include <bits/stdc++.h>
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;
}
int main() {
long long... |
Problem: 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 be... | // Main Code at the Bottom
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
public class Main {
//Fast IO class
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
boolean env=System.getProperty("ONLINE_JUD... |
Problem: 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 be... | import java.util.Scanner;
public class C_125B_2 {
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.nextInt();
int r2 = sc.nextInt();
int R2 = s... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int N = (int)1e7;
int n, m, a[200000], b[200000], pn, p[N];
bool u[N + 2];
vector<int> e[664600], g[664600];
int main() {
p[pn++] = 2;
for (int i = 3; i < N; i += 2)
if (!u[i]) {
p[pn++] = i;
if (1LL * i * i > N) continue;
for (int j = i * i;... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class P_222C {
static final FS sc = new FS();
static final PrintWriter pw = new PrintWriter(System.out);
static final int N = (int) (1e7+9);
st... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.*;
import java.util.*;
public class Main {
private static final int SMAX = 3162;
private static final int MAX = 10000000;
public BufferedReader br;
public int[] prime;
public int[] id;
public Integer[] primeArray;
public int[] cntA;
public int[] cntB;
public int[] ... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
long long Simple[] = {
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89,
97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
157, 163, 167, 173, ... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
vector<long long int> primes, vprimes;
int sp[10000005];
map<long long int, long long int> m1, m2;
vector<long long int> num, den, innum, inden;
void soe() {
for (int i = 2; i < 10000005; i++)
if (!sp[i]) {
primes.push_back(i);
for (int j = i; j < 10000005... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.*;
import java.util.*;
public class ProblemC {
static StreamTokenizer in = new StreamTokenizer(new BufferedReader(
new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
static PrintWriter err = new PrintWriter(System.err);
static int nextI... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
int p[10000010];
void predo() {
for (int i = 2; i * i < 10000010; i++)
if (!p[i])
for (int j = i * i; j < 10000010; j += i) p[j] = i;
for (int i = 2; i < 10000010; i++)
if (!p[i]) p[i] = i;
}
void shik(int n, int s[], int t[]) {
for (int i = 0; i < n; i+... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
const double eps = 1e-7, PI = 3.1415926;
const int N = 1e7 + 10, M = 1e5 + 10;
using namespace std;
int n, q, m, k, x, y, a[M], mx = -1, mn = 1e9, sum, mp[N], sum2, b[M], mp1[N],
mp2[N];
vector<long long> vec, vec2;
int spf[N];
void sieve() {
spf[1] = 1;
for (int... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #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();
}
int n, m;
bool isPrime[10000005];
int sp[10000005];
map<int, int> num;
map<int,... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
int p[300000], pcnt;
int deg[10000000 + 10];
bool np[10000000 + 10];
int a[300000], b[300000];
int n, m;
int len, lenb;
int x, t;
void add(int x) {
int xx = x;
for (int j = 1; j <= pcnt; j++) {
if (p[j] * 1ll * p[j] > xx) break;
while (x % p[j] == 0) {
x /... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> v(10000001, 0);
vector<int> primes(10000001, 0);
vector<int> primes1(10000001, 0);
for (int i = 2; i < v.size(); i++) {
if (v[i] == 0) {
v[i] = i;
int j = i;
while (i * 1ll * j < v.size()) {
if (v[i * 1ll * j] =... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int MAXN = 1e7 + 5;
bool v[MAXN];
int spf[MAXN];
unordered_map<int, int> pfa, pfb;
unordered_map<int, int> newpfa, newpfb;
void Sieve() {
for (long long int i = 2; i <... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int cnst = 100010;
const int inf = 10000010;
int a[cnst], b[cnst];
int p[inf], x[inf], y[inf];
void f(int n, int ms[], int mp[]) {
for (int i = 0; i < n; i++)
for (int j = ms[i]; j > 1; j /= p[j]) mp[p[j]]++;
}
void print(int n, int ms[], int mp[]) {
for (int ... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... |
import java.util.*;
import java.io.*;
public class C
{
public static void main(String[] args)
{
new C(new FastScanner());
}
int[] primes;
void genPrimes(int mx) {
boolean[] isPrime = new boolean[mx+1];
Arrays.fill(isPrime,true);
int numPrimes = 0;
isPrime[0] = isPrime[1] = false;
for(i... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.*;
import java.util.*;
public class Myclass {
// static ArrayList a[]=new ArrayList[3000001];
static int prime[]=new int [10000001];
static long freq[]=new long [10000001];
static long freq1[]=new long [10000001];
static void seive() {
for(int i=0;i<=1e7;i++)
prim... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long p[10000007];
long long a[100005], b[100005], x[10000007], y[10000007];
void seive() {
for (long long i = 2; i *... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.*;
import java.util.*;
public class utkarsh {
BufferedReader br;
PrintWriter out;
int spf[], z = (int)(1e7 + 123);
int[] play(int[] a, int n) {
int d[] = new int[z];
for(int x : a) {
while(spf[x] > 1) {
d[spf[x]]++;
x /= spf... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
public class C {
st... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import ... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int MXN = 10000010;
int a[100010], b[100010], prm[MXN], aprm[MXN], bprm[MXN];
int n, m;
void solve(int n, int *x, int *ansprm) {
int i, j;
for (i = 0; i < n; i++) {
for (j = x[i]; j > 1; j /= prm[j]) ansprm[prm[j]]++;
}
}
void prnt(int n, int *x, int *ansprm... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | //package round137;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
public class C2 {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int[] primes = sieveEratosthen... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.util.*;
import java.io.*;
public class P222C {
private static void solve() {
int n = nextInt();
int m = nextInt();
int MAX = 10000000;
int[] primes = new int[MAX + 10];
for (int i = 0; i <= MAX; i++) {
primes[i] = i;
}
for (int i = 2; i * i <= MAX; i++) {
if (... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000100;
int a[MAXN], b[MAXN], prim[MAXN], x[MAXN], y[MAXN];
void init() {
for (int i = 2; i * i <= MAXN; i++)
if (!prim[i])
for (int j = i; j <= MAXN; j += i) prim[j] = i;
for (int i = 2; i <= MAXN; i++)
if (!prim[i]) prim[i] = i;
}
void... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int M = 100005;
const int MM = 4000;
bool vis[MM];
int a[M], b[M];
int prime[M], prime_size;
map<int, int> Hash_Prime;
int cnt_num_prime[M + MM], cnt_denum_prime[M + MM], div_num_prime[M + MM],
div_denum_prime[M + MM];
list<int> L[M + MM];
void prime_produce() {
... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // создаём объект класса Scanner
int n = sc.nextInt();
int m = sc.nextInt();
int [] a = new int[n];
for(int i... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
const int N = 10000010;
int a[maxn], b[maxn];
int p[N], x[N], y[N];
void init() {
int i;
for (i = 2; i * i < N; i++)
if (!p[i])
for (int j = i * i; j < N; j += i) p[j] = i;
for (i = 2; i < N; i++)
if (!p[i]) p[i] = i;
}
void go(i... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e18;
const int MAXN = 1e7 + 5;
const int T = 1e3 + 10;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
long long binpow(long long val, long long deg) {
if (!deg) return 1;
if (deg & 1) return binpow(val, deg - 1) * val... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
bool f1(pair<long long, long long> x, pair<long long, long long> y) {
return x.first < y.first;
}
bool f2(pair<long long, long long> x, pair<long long, long long> y) {
return x.first > y.first;
}
bool f3(long long x, long long y) { return x > y; }
long long gcd(long lon... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = (int)1e7 + 10;
int p[maxn], a[maxn], b[maxn], A[maxn], B[maxn];
int main() {
for (int i = 2; i * i < maxn; i++) {
if (p[i]) continue;
for (int j = i ... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
int prime[670000], m, i, j, f[670000], g[670000], x, a[670000], b[670000], r, n;
int p[10000000];
int main() {
memset(p, 0, sizeof(p));
m = 0;
for (i = 2; i < 10000000; i++) {
if (p[i] == 0) {
prime[m] = i;
p[i] = m;
m++;
}
for (j = 0; j < m && (long long)i *... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class P222C {
public... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | #include <bits/stdc++.h>
using namespace std;
int a[10000010], b[10000010], n, m;
int nume[10000010], deno[10000010];
int no_prime[10000010];
void facto(int x, int v[]) {
for (int i = 2; i * i <= x && no_prime[x]; i++)
while (x % i == 0) v[i]++, x /= i;
if (x > 1) v[x]++;
}
void get_number(int x, int v[]) {
i... |
Problem: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the second set gives the fraction denominator. However, it turned o... | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class Problem137C {
public static void main(String[] args) throws Exception {
int max = 10000000;
int[] spf = smallestPrimeFactor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.