output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
const double inf = 1e20, eps = 1e-9;
const int N = 1005;
double p[N][N], f[N], g[N], P[N];
int n, vis[N];
int main() {
scanf("%d", &n);
for (register int i = 1; i <= n; ++i)
for (register int j = 1; j <= n; ++j)
scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
for ... | ### Prompt
In cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
int n, temp;
double p[1000][1000];
double dis[1000], q[1000];
bool vis[1000];
int main(void) {
scanf("%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) {
scanf("%d", &temp);
p[i][j] = temp / 100.0;
}
for (int i = 0; i < n; i++) {
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
double x[2010], y[2010];
double a[2010][2010];
int vis[2010];
double dis[2010];
int main() {
int i, j, m, n, s, t, k, min;
scanf("%d", &n);
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++) {
scanf("%d", &t);
a[i][j] = t / 100.0;
}
for (i = 1; i ... | ### Prompt
Develop a solution in CPP to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n, vst[N];
double p[N][N], g[N], f[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
for (int i = 1; i < n; i++) g[i] = f[i] = 1;
f[n] = 0;
for (int i =... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1000 + 5;
const double inf = 1e18;
int n;
double f[Maxn], p[Maxn], g[Maxn][Maxn];
bool vis[Maxn];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
int x;
scanf("%d", &x);
g[i][j] = 1.0 * x /... | ### Prompt
Create a solution in Cpp for the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to g... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n;
double dis[N][N], E[N], prod[N];
bool vis[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
double x;
scanf("%lf", &x);
dis[i][j] = x / 100;
}
if (n == 1) {
puts("0");
... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
int n;
double p[1010][1010];
double f[1010];
double sum[1010];
double rest[1010];
bool chk[1010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", p[i] + j), p[i][j] /= 100;
for (int i = 1; i < n; i++) f[i] = 1e8... | ### Prompt
In CPP, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
inline int read() {
int x;
char c;
while ((c = getchar()) < '0' || c > '9')
;
for (x = c - '0'; (c = getchar()) >= '0' && c <= '9';) x = x * 10 + c - '0';
return x;
}
int u[1000 + 5];
double p[1000 + 5][1000 + 5], v[1000 + 5], r[1000 + 5], z;
int main() {
int n = read(), i, j, k... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const long double inf = 1e30;
long double A[MAXN], B[MAXN];
priority_queue<pair<long double, int>, vector<pair<long double, int> >,
greater<pair<long double, int> > >
q;
int n;
long double P[MAXN][MAXN];
void load() {
scanf("%d", ... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
template <class T1, class T2>
inline bool cmin(T1 &a, const T2 &b) {
return b < a ? (a = b, true) : false;
}
template <class T1, class T2>
inline bool cmax(T1 &a, const T2 &b) {
return a < b ? (a = b, true) : false;
}
template <class Type>
Type read() {
Type a;
bool b;
unsigned char c... | ### Prompt
Generate a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 1;
double p[MAXN][MAXN];
double E[MAXN];
double A[MAXN], B[MAXN];
bool vis[MAXN];
int n;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
scanf("%lf", &p[i][j]);
}
}
for (int i = 0; i < MA... | ### Prompt
Generate a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
const double eps = 1e-6;
int n;
double p[N][N];
double zaden[N];
double curr[N];
double ans[N];
bitset<N> vis;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> n;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; +... | ### Prompt
In Cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
const int N = 1e3 + 100;
int n;
long double p[N][N];
void init() {
std::cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
int t;
scanf("%d", &t);
p[i][j] = (long double)t / 100.0;
}
}
}
void work() {
static long double f[N], g[N];
static... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1},
{-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
template <class T>
inline T abs1(T a) {
return a < 0 ? -a : a;
}
template <typename t,... | ### Prompt
In cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
int n;
double P[1050][1050];
double F[1050], R[1050], D[1050];
bool fix[1050];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &P[j][i]), P[j][i] /= 100;
for (int i = 1; i < n; i++)
F[i] = std::numeric_limits<double>::max(), R[i... | ### Prompt
Construct a cpp code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(T x) {
return x * x;
}
const int maxn = 1003;
int p[maxn][maxn];
double sum[maxn], pr[maxn];
bool used[maxn];
double getans(double x, double y) { return (x + y) / (1 - y); }
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
f... | ### Prompt
Construct a Cpp code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
int n, v[1010];
long double p[1010][1010], a[1010], d[1010];
int work() {
int k;
long double x = 1e100L;
for (int i = 1; i <= n; i++)
if (!v[i] && (d[i] + a[i]) / (1 - a[i]) <= x)
x = (d[i] + a[i]) / (1 - a[i]), k = i;
v[k] = 1, d[k] = (d[k] + a[k]) / (1 -... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005;
const double eps = 1e-15;
const double INF = 1e100;
template <typename T>
void chkmax(T &x, T y) {
x = max(x, y);
}
template <typename T>
void chkmin(T &x, T y) {
x = min(x, y);
}
template <typename T>
void read(T &x) {
x = 0;
int f = 1;
cha... | ### Prompt
In CPP, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
int n;
double f[1005], p[1005][1005], prod[1005];
bool vis[1005];
inline int read() {
int x = 0;
char ch = getchar();
while (!isdigit(ch)) ch = getchar();
while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
return x;
}
int main() {... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0;
bool t = false;
char ch = getchar();
while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
if (ch == '-') t = true, ch = getchar();
while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
return t ? -x : x;
}
i... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') f = -1;
ch = getchar();
}
while (isdigit(ch)) {
x = x * 10 + ch - 48;
ch = getchar();
}
return x * f;
}
int n;
bool vis[1050];
double pro[1050][105... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp &x) {
x = 0;
char c = getchar();
int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar())
;
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar())
;
if (f) x = -x;
}
const int ... | ### Prompt
Please create a solution in Cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1011;
double p[N][N];
double a[N], b[N];
double q[N];
bool vis[N];
const double inf = 1e30;
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
double x;
scanf("%lf", &x);
p[i][j] = x;
... | ### Prompt
Your task is to create a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
double p[1005][1005], q[1005], dis[1005];
int vis[1005];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100;
}
for (int i = 1; i <= n; i++) {
dis[i] = 1;
... | ### Prompt
Create a solution in cpp for the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to g... |
#include <bits/stdc++.h>
using namespace std;
int n;
double p[1010][1010];
bool book[1010];
double f[1010], s[1010], sp[1010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
f[i] = 1e18;
sp[i] = 1;
s[i] = 0;
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= ... | ### Prompt
Please formulate a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::istream& operator>>(std::istream& i, pair<T, U>& p) {
i >> p.first >> p.second;
return i;
}
template <typename T>
std::istream& operator>>(std::istream& i, vector<T>& t) {
for (auto& v : t) {
i >> v;
}
return i;
}
templat... | ### Prompt
Your task is to create a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n;
bool fix[N];
double p[N][N], e[N], X[N], Y[N];
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cout << setprecision(6) << fixed;
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) {
int x;
... | ### Prompt
Create a solution in CPP for the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to g... |
#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
return (!b ? 1
: (b & 1 ? a * poww(a * a % md, b / 2, md) % md
: poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e3 + 10;
const long long INF = 1e18;
const long long ... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
if (a > b) {
return a;
} else {
return b;
}
}
long long min(long long a, long long b) {
if (a < b) {
return a;
} else {
return b;
}
}
vector<string> split(const string& s, char c) {
vector<string> v;
... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
static double p[1005][1005], d[1005], a[1005], b[1005];
scanf("%d", &n);
for (int i = 1; i <= n; ++i) d[i] = 1e30, a[i] = b[i] = 1.00000;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
scanf("%lf", &p[i][j]);
p[i][j... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
const int maxn = 1010;
double f[maxn], e[maxn];
inline double calc(int id) { return (f[id] + 1) / (1 - e[id]); }
int p[maxn][maxn], vis[maxn], n;
int main() {
std::ios::sync_with_stdio(false), std::cin.tie(0);
std::cin >> n;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) st... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int chkmax(T &a, T b) {
return a < b ? a = b, 1 : 0;
}
template <typename T>
inline int chkmin(T &a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
T sum = 0, fl = 1;
char ch = getchar();
for (; !isdigit(... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbs(string str, T t) {
cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
int idx = str.find(',');
cerr << str.substr(0, idx) << " : " << t << ",";
dbs(str.substr(idx + 1), s...);
}
templat... | ### Prompt
Develop a solution in CPP to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1011;
const double Eps = 1e-8;
int p[N][N];
double acc[N];
double old[N];
double ans[N];
bool vis[N];
int main() {
ios ::sync_with_stdio(false);
int n;
cin >> n;
if (n == 1) {
cout << 0 << '\n';
return 0;
}
for (int i = 1; i <= n; i++)
... | ### Prompt
Generate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int v = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
v = v * 10 + c - '0';
c = getchar();
}
return v * f;
}
const int Maxn = 1005;
double p[... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
const int N = 1005;
const long double eps = 1e-10;
int n, x;
bool vis[N];
long double p[N][N], f[N], prod[N], sum[N];
bool zero(long double x) { return std::abs(x) < eps; }
void update(int x) {
vis[x] = 1;
for (int i = 1; i <= n; ++i) {
if (!vis[i]) {
sum[i] += (1 + f[x]) * p[i][x... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
bool SR(int &x) { return scanf("%d", &x) == 1; }
bool SR(long long &x) { return scanf("%lld", &x) == 1; }
bool SR(double &x) { return scanf("%lf", &x) == 1; }
bool SR(char *s) { return scanf("%s", s) == 1; }
bool RI() { return true; }
template <typename I, typename... T>
bo... | ### Prompt
Generate a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
const int N = 1005;
int n, p[N][N];
double f[N], g[N];
bool vis[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%d", &p[i][j]);
for (int i = 1; i < n; i++) f[i] = g[i] = 1;
for (int i = 1; i <= n; i++) {
double mn = 1e9;
int... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const long double DINF = pow(2, 100);
const int MAXN = 1007;
const long double EPS = 1e-9;
int n;
long double p[MAXN][MAXN];
long ... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
int n, vis[1005]... | ### Prompt
Generate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 10;
double p[maxn][maxn], dis[maxn], v[maxn];
int vis[maxn], n;
int main() {
memset(dis, 0, sizeof(dis));
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100;
... | ### Prompt
In CPP, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
int n, p[1010][1010], vis[1010];
double A[1010], B[1010], ex[1010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%d", &p[i][j]);
for (int i = 1; i <= n - 1; i++) ex[i] = 1e9, A[i] = B[i] = 1;
ex[n] = 0;
for (in... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1.01e9;
const double eps = 1e-9;
const int maxn = 1010;
double d[maxn];
double p[maxn][maxn];
double sum[maxn];
double prod[maxn];
int used[maxn];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; (i) < (n); ++i)
for (int j = 0; (j) < (n); ... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "inline")
using namespace std;
template <class T>
inline void read(T &x) {
int ch = 0, f = 0;
x = 0;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = 1;
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
if (f) x = -x;
}
const int N = 10... | ### Prompt
In CPP, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
double P[1001][1001], f[1001], p[1001];
int N, vi[1001];
int main() {
scanf("%d", &N);
for (int i = 1; i <= N; i++)
for (int j = 1; j <= N; j++) {
scanf("%lf", P[i] + j);
P[i][j] /= 100;
}
for (int i = 1; i < N; i++) {
f[i] = 1;
p[i] = 1 - P[i][N];
}
f[N] =... | ### Prompt
Please formulate a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
int n;
bool vis[N];
double e[N], p[N][N], prod[N], mn;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
if (n == 1) {
puts("0");
return 0;
}
for (i... | ### Prompt
Please provide a cpp coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int s[N][N];
bool w[N], us[N];
double p[N], f[N], g[N];
inline int gi() {
int x = 0, o = 1;
char ch = getchar();
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') o = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const double inf = 1e20;
const double eps = 1e-9;
const int maxn = 1e3 + 3;
double p[maxn][maxn], f[maxn], g[maxn], P[maxn];
int n, vis[maxn];
int main() {
scanf("%d", &n);
for (register int i = 1; i <= n; i++)
for (register int j = 1; j <= n; j++)
scanf("%lf"... | ### Prompt
Your task is to create a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
template <typename Type>
inline bool chkmin(Type &x, const Type &y) {
return x > y ? (x = y, 1) : 0;
}
template <typename Type>
inline bool chkmax(Type &x, const Type &y) {
return x < y ? (x = y, 1) : 0;
}
template <typename Type>
inline Type read(Type &f) {
f = 0;
... | ### Prompt
In Cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
template <typename T>
void read(T &x) {
x = 0;
int f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + c - '0';
x *= f;
}
int n;
double g[N][N];
d... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
double p[1005][1005], f[1005], prod[1005];
bool vis[1005];
int main() {
int n, x;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%d", &x), p[i][j] = x / 100.0;
for (int i = 1; i < n; i++) prod[i] = 1, f[i] = 1;
for (int i = 1... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
void read(int &digit) {
digit = 0;
char c;
for (c = getchar(); (c < '0' || c > '9') && c != '-'; c = getchar())
;
bool type = false;
if (c == '-') type = true, c = getchar();
for (; c >= '0' && c <= '9'; digit = digit * 10 + c - '0', c = getchar())
;
i... | ### Prompt
Your task is to create a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
struct Reader {
istream& is;
template <typename T>
operator T() const {
T t;
is >> t;
return t;
}
};
const int N = 1000;
double p[N][N], prod[N], E[N];
bool v[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
Reader r{cin};
int... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n;
double p[N][N], E[N], g[N], f[N];
bool vis[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
for (int i = 1; i <= n; i++) g[i] = 1 - p[i][n];
vis[n]... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
char c;
int flag = 1;
for (c = getchar(); !(c >= '0' && c <= '9' || c == '-'); c = getchar())
;
if (c == '-')
flag = -1, n = 0;
else
n = c - '0';
... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int N;
bool used[maxn];
double A[maxn], B[maxn], P[maxn][maxn], ans[maxn];
priority_queue<pair<double, int>, vector<pair<double, int> >,
greater<pair<double, int> > >
heap;
void SP() {
heap.push(pair<double, int>(0, N));
while (... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
int n;
double tab[1007][1007];
int jusz[1007];
double tak[1007];
double wyn[1007];
double tam;
double tu;
double nie;
int v;
int zero(double v) { return abs(v) < 0.000000001; }
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++)... | ### Prompt
Please create a solution in Cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1005;
double p[Maxn][Maxn], e[Maxn], f[Maxn];
int vis[Maxn];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100;
for (int i = 1; i < n; i++) f[i] = 1, e[i] = 1;
... | ### Prompt
In cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
int n;
double dist[1050], pre[1050];
bool vis[1050];
double P[1050][1050];
int main() {
scanf("%d", &n);
if (n == 1) {
printf("0.0\n");
return 0;
}
for (int i = 1; i <= n; ++i) {
pre[i] = dist[i] = 1;
for (int j = 1; j <= n; ++j) {
int Po;
... | ### Prompt
In Cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, a[N][N], p;
double mini, f[N], g1[N], g2[N], sum[N];
bool o[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
f[i] = 1.0 / a[i][n];
g1[i] = 1;
}
f[n] = 0;
for (int i... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return x * f;
}
const int MAXN = 1010;
const double INF = 1e100;
double p[MAXN + 1][MAXN ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 1;
inline long long input(void) {
char t;
long long x = 0;
int neg = 0;
t = getchar();
while ((t < 48 || t > 57) && t != '-') t = getchar();
if (t == '-') {
neg = 1;
t = getchar();
}
while (t >= 48 && t <= 57) {
x = (... | ### Prompt
Generate a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
int n, i, j, k, a[1010][1010];
double cd, co, d[1010], o[1010], p[1010][1010];
bool was[1010];
int main() {
scanf("%d", &n);
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++) {
scanf("%d", &a[i][j]);
p[i][j] = a[i][j] / 100.;
}
for (i = 1; i < n; i++) d[i] = 1e20;
wh... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
const int INF = (int)1e9 + 100;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int maxn = 1100;
int n;
long double a[maxn][maxn];
long double curexp[maxn];
long double lft[maxn];
int used[maxn];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
... | ### Prompt
Generate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int N = 1010;
int n;
double p[N][N];
double pi[N];
double e[N];
int vis[N];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100.0;
}
for (int... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
int n;
long double p[1005][1005];
long double E[1005];
long double prob[1005];
bool bio[1005];
int pp[1005][1005];
int main() {
cin >> n;
for (int i = (int)(0); i < (int)(n); ++i)
for (int j = (int)(0); j < (int)(n); ++j)
scanf("%d", pp[i] + j), p[i][j] = pp[i... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
int n, d[1005], cnt;
double p[1005][1005], f[1005], g[1005], h[1005];
bool vis[1005];
int main() {
cin >> n;
int x;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
cin >> x;
p[i][j] = (double)x / 100.0;
}
}
vis[n] = 1;
d[++cnt] ... | ### Prompt
Please create a solution in Cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n;
double p[N][N], d[N], pr[N];
int vis[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
int x;
scanf("%d", &x);
p[i][j] = x / 100.0;
}
for (int i = 1; i <= n; i++) d[i] = 1... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000001000;
const long long INFL = 2000000000000001000;
int solve();
int main() {
srand(2317);
cout.precision(10);
cout.setf(ios::fixed);
int tn = 1;
for (int i = 0; i < tn; ++i) solve();
}
const int maxn = 1001;
double p[maxn][maxn];
bool used[max... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
double p[1005][1005];
double ps[1024], val[1024];
bool vis[1024];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100;
}
}
for (int i = 1; i <= n; i++) {
ps[i] = 1;
val[i]... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 50;
const double INF = 1e18;
int n;
double p[N][N], dp[N], coe[N];
bool vs[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
for (int i = 1; i <= n; i++) coe[i]... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
int n;
int p[1013][1013];
bool done[1013];
double ans[1013];
double tot[1013];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) scanf("%d", &p[i][j]);
for (int i = 0; i < n; i++) {
ans[i] = 1 / 0.;
tot[i] = 1;
}
ans... | ### Prompt
Create a solution in Cpp for the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to g... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n;
double p[N][N], E[N], s[N];
bool vis[N];
int main() {
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", &p[i][j]), p[i][j] /= 100.0;
vis[n] = true;
if (n == 1) return puts("0"), 0;
for (int i = 1; i < n... | ### Prompt
Create a solution in CPP for the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to g... |
#include <bits/stdc++.h>
using namespace std;
template <typename tn>
void read(tn &a) {
tn x = 0, f = 1;
char c = ' ';
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
a = x * f;
}
const int N = 1010;
int n, vis[N];
double mp[N][N], f[N], g[N... | ### Prompt
In Cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
int n;
double A[1010], B[1010];
double p[1010][1010];
double dis(int u) { return (B[u] + 1) / (1 - A[u]); }
int mark[1010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100;
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, vis[N];
double dp[N], p[N][N], tmp[N];
template <typename _Tp>
inline void IN(_Tp& x) {
char ch;
bool flag = 0;
x = 0;
while (ch = getchar(), !isdigit(ch))
if (ch == '-') flag = 1;
while (isdigit(ch)) x = x * 10 + ch - '0', ch = g... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
const long double eps = 1e-10;
int n, vis[N];
long double p[N][N], cnt[N], dis[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
for (int j = 1, x; j <= n; ++j)
scanf("%d", &x), p[i][j] = (long double)(x) / (long double)(100)... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
int n, vis[1001], a[1001];
double p[1001][1001], d[1001], pr[1001], sum[1001];
int main() {
scanf("%d", &n);
for (register int i = 1; i <= n; ++i) {
register int now = 0;
sum[i] = pr[i] = 1.0;
for (register int j = 1; j <= n; ++j)
scanf("%d", &now), p[i][j] = now * 0.01;
... | ### Prompt
Please formulate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
int n, vi[N];
double p[N][N], dp[N], sum[N][N], all[N];
inline int read() {
int f = 1, x = 0;
char s = getchar();
while (s < '0' || s > '9') {
if (s == '-') f = -1;
s = getchar();
}
while (s >= '0' && s <= '9') {
x = x * 10 + s - '0... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
constexpr int inf32 = 0x3f3f3f3f;
constexpr long long inf64 = 0x3f3f3f3f3f3f3f3f;
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cout.precision(12), cout << fixed;
int n;
cin >> n;
int cnt = n;
vector<vector<double>> p(n, vector<double>(n))... | ### Prompt
Develop a solution in Cpp to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
const double eps = 1e-8;
double p[maxn][maxn], lp[maxn], dis[maxn], cur[maxn];
int n;
bool vis[maxn];
inline void dijkstra() {
register int i, j, t;
for (i = 0; i < n; i++) vis[i] = 0, dis[i] = 1. / 0., cur[i] = 0, lp[i] = 1;
dis[n - 1] = 0;
f... | ### Prompt
Generate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n;
int p[N][N];
bool f[N];
double d[N], K[N], B[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
scanf("%d", &p[i][j]);
if (i == j) p[i][j];
}
for (int i = 1; i <= n; ++i) {
d... | ### Prompt
Please formulate a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
bool vis[N];
int n;
double f[N];
double p[N][N], pro[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1, tmp; j <= n; j++) {
scanf("%d", &tmp);
p[i][j] = 1.0 * tmp / 100.0;
}
}
if (n == 1) {
... | ### Prompt
Generate a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
bool vis[N];
int n;
double f[N];
double p[N][N], pro[N];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1, tmp; j <= n; j++) {
scanf("%d", &tmp);
p[i][j] = 1.0 * tmp / 100.0;
}
}
if (n == 1) {
... | ### Prompt
Generate a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
const double INF = 1e80;
const int N = 1e3;
int n;
double p[N + 5][N + 5], f[N + 5], g[N + 5];
bool vis[N + 5];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
scanf("%lf", &p[i][j]);
p[i][j] /= 100;
}
}
for (int i = 1; i <... | ### Prompt
In Cpp, your task is to solve the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to ... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int MN = 1e3 + 10;
int n;
long double E[MN], D[MN], T[MN], p[MN][MN];
bool mk[MN];
void relax(int v) {
for (int u = 0; u < n; ++u)
if (!mk[u]) {
D[u] += T[u] * p[u][v] * E[v];
T[u] *= (1 - p[u][v]);
if (T[u] == 0)
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
const int MX = 1005;
int n, x;
double adj[MX][MX], p, res[MX], no[MX], acu[MX];
bitset<MX> bs;
bool igual(double a, double b) { return fabs(a - b) < 1e-12; }
bool le(double a, double b) { return a < b && !igual(a, b); }
int main() {
ios_base::sync_with_stdio(0);
cin.tie... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int a = 0, f = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') f = -1;
for (; isdigit(ch); ch = getchar()) a = (a << 3) + (a << 1) + ch - '0';
return a * f;
}
const int mod = 1e9 + 7;
const int N = 1e3 + 5;
const... | ### Prompt
Your task is to create a Cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
int n;
double p[1010][1010], a[1010], b[1010], d[1010];
bool vis[1010];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%lf", p[i] + j), p[i][j] /= 100;
for (int i = 1; i <= n; i++) d[i] = 1e9, a[i] = b[i] = 1;
d[n]... | ### Prompt
Generate a CPP solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need to get... |
#include <bits/stdc++.h>
using namespace std;
char buf[1000000], *P1, *P2;
int n;
double dp[1005], nw[1005], a[1005][1005];
bool vs[1005];
int rd() {
int res = 0;
char c = 0;
while (!isdigit(c))
c = (P1 == P2 && (P2 = (P1 = buf) + fread(buf, 1, 1000000, stdin), P1 == P2)
? EOF
: *P1+... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
const int mod = 1000000007;
const int inf = 1000000009;
const long long INF = 1000000000000000009;
const long long big = 1000000000000000;
const long double eps = 0.000000000000000000001;
using namespace std;
double E[100005], CE[100005], P[100005];
double licz(int x) {
if (P[x] == 1) return ... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
int n, x;
bool vis[1005];
double E[1005], g[1005], a[1005][1005];
double calc(int u) { return (E[u] + g[u]) / (1.0 - g[u]); }
void Rel(int x) {
if (x == 1) {
printf("%.12lf\n", calc(x));
exit(0);
}
vis[x] = true;
for (int i = 1; i <= n; ++i)
if (!vis[i])... | ### Prompt
Please provide a CPP coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
int p[1001][1001];
int vis[1001];
double dis[1001], tmp[1001];
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) cin >> p[i][j];
for (int i = 1; i <= n; i++) dis[i] = 1e18;
dis[n] = 0;
for (int i = 1; i <= n; i++) {
... | ### Prompt
Construct a cpp code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
char c = getchar();
int x = 0;
bool f = 0;
for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
if (f) x = -x;
return x;
}
int n;
long double p[1005][1005], dis[1005], rest... | ### Prompt
Please provide a cpp coded solution to the problem described below:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 a... |
#include <bits/stdc++.h>
using namespace std;
int N;
double P[1010][1010] = {{0}};
double dist[1010] = {0};
double mult[1010] = {0};
int Hash[1010] = {0};
int main() {
cin >> N;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= N; j++) scanf("%lf", &P[i][j]), P[i][j] /= 100;
mult[i] = 1;
}
mult[N] = 0... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
double a[1001][1001], p[1001], t[1001], w;
int n, s, v[1001];
inline double f(int x) {
if (t[x] == 1) return 100000000;
return (p[x] + 1) / (1 - t[x]);
}
int main() {
scanf("%d", &n);
for (int i = (1); i <= (n); i++)
for (int j = (1); j <= (n); j++) {
scan... | ### Prompt
Construct a CPP code solution to the problem outlined:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you need t... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1000 + 77;
int n, m;
bool M[N];
double A[N], P[N], Q[N], Pr[N][N];
int main() {
for (int i = 0; i < N; i++) {
Q[i] = 1;
A[i] = 1e9;
}
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
int ts;
scanf("... | ### Prompt
Please create a solution in CPP to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
long long res = 1;
a %= mod;
for (; b; b >>= 1) {
if (b & 1) res = res * a % mod;
a = a * a % mod;
}
return res;
}
const int N = 1010;
int n, p[N][N], vis[N];
long double E[N], ... | ### Prompt
Please create a solution in cpp to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and you nee... |
#include <bits/stdc++.h>
const int MN = 1005;
int N, p[MN][MN];
double dis[MN], val[MN];
void Dijk() {
static int can[MN], vis[MN];
for (int i = 1; i <= N; ++i) dis[i] = val[i] = 1, can[i] = vis[i] = 0;
dis[N] = val[N] = 0, can[N] = 1;
for (int k = 1; k <= N; ++k) {
int u = 0;
for (int i = 1; i <= N; ++... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long BIG = 1446803456761533460LL;
const int Big = 336860180;
const long long int INF = LONG_LONG_MAX;
const vector<vector<long long int> > adj4({{0, 1}, {0, -1}, {1, 0}, {-1, 0}});
const vector<vector<long long int> > adj8(
... | ### Prompt
Your task is to create a cpp solution to the following problem:
The scientists have recently discovered wormholes β objects in space that allow to travel very long distances between galaxies and star systems.
The scientists know that there are n galaxies within reach. You are in the galaxy number 1 and y... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.