output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
void readi(int &x) {
int v = 0, f = 1;
char c = getchar();
while (!isdigit(c) && c != '-') c = getchar();
if (c == '-')
f = -1;
else
v = v * 10 + c - '0';
while (isdigit(c = getchar())) v = v * 10 + c - '0';
x = v * f;
}
void readll(long long &x) {
l... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 201;
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 * 10 + ch - '0';
ch = getchar();
}
return x * f;
}
int n, m... | ### Prompt
Please create a solution in cpp to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 105;
int n, m, a, b;
int dis[MAXN][MAXN];
int ans[MAXN], temp[MAXN];
vector<int> ms[MAXN];
vector<int> vec[MAXN][MAXN];
int s[MAXN], t[MAXN];
void solved(int cas) {
int x, y;
scanf("%d %d %d %d", &n, &m, &a, &b);
memset(dis... | ### Prompt
Construct a CPP code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
vector<int> G1[maxn];
int n, m, a, b, q, mp[maxn][maxn], must[maxn][maxn], num[maxn];
int dist[maxn], vis[maxn], p[maxn], fb[maxn], tb[maxn], dp[maxn], Md[maxn];
struct Heap {
int u, d;
Heap(int _u = 0, int _d = 0) {
u = _u;
d = _d;
}
b... | ### Prompt
Develop a solution in Cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, S, T, x, y, num;
int a[110][110], b[110][110], s[110], t[110], an[110], h[110], f[110],
c[110][110];
int dfs(int x, int y) {
if (h[x] == num) return f[x];
h[x] = num;
int i, ans = -1;
for (i = 1; i <= n; i++)
if (a[x][i] == 1 && a[x][i] + ... | ### Prompt
Please formulate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int sum = 0;
char c = getchar();
bool f = 0;
while (c < '0' || c > '9') {
if (c == '-') f = 1;
c = getchar();
}
while (c >= '0' && c <= '9') {
sum = sum * 10 + c - '0';
c = getchar();
}
if (f) return -sum;
return sum;
}
... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, S, T, x, y, num;
int a[110][110], b[110][110], s[110], t[110], an[110], h[110], f[110],
c[110][110];
int dfs(int x, int y) {
if (h[x] == num) return f[x];
h[x] = num;
int i, ans = -1;
for (i = 1; i <= n; i++)
if (a[x][i] == 1 && a[x][i] + ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int inf = 100000000;
int dis[N][N], c[N][N], res[N];
int s[N], t[N], tmp[N], ans[N];
int n, m, vs, vt, x, y, tim;
int dfs(int x, int y) {
if (tmp[x] == tim) return res[x];
tmp[x] = tim;
int mx = -1;
for (int i = 1; i <= n; i++)
if (dis[x... | ### Prompt
Please formulate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
vector<int> e[101];
int n, m, a, b, k, s[101], t[101], r[101], d[101][101], seen[101], next_seen;
bool must[101][101];
int main() {
scanf("%d %d %d %d", &n, &m, &a, &b);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) d[i][j] = i == j ? 0 : 1000000000;
w... | ### Prompt
Develop a solution in Cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 10, INF = INT_MAX / 2;
int n, m, a, b, dis[MAXN][MAXN], dp[MAXN][MAXN], cnt[MAXN];
vector<int> adj[MAXN], g[MAXN][MAXN], vec[MAXN];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> a >> b, a--, b--;
for (i... | ### Prompt
Please formulate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
bool debug = false;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int dis[105][105];
int S, T, ans[105], cnt, h[105], f[105];
int b[105][105], must[105][105];
vector<pair<int, int>> bus;
int dfs(int x, int t) {
if (h[x] == cnt) retur... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int N = 105, inf = 1e9;
int n, d[N][N], c, m, s[N], t[N], v[N], g[N][N], p[N], q[N], e[N][N];
int dfs(int a, int k) {
if (v[a] == c) return q[a];
v[a] = c, q[a] = -1;
for (int i = 1; i <= n; i++)
if (d[a][i] == 1 && d[a][t[k]] == d[i][t[k]] + 1)
q[a] =... | ### Prompt
Construct a cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
template <class K>
inline bool chkmin(K &a, K b) {
return a > b ? a = b, true : false;
}
template <class K>
inline bool chkmax(K &a, K b) {
return a < b ? a = b, true : false;
}
using namespace std;
const int oo = 0x3f3f3f3f;
const int maxn = 200 + 1;
int N, M, K, G[maxn][maxn], path[maxn][... | ### Prompt
Create a solution in Cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0;
char c = getchar();
while (c < '0' || c > '9') c = getchar();
while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x;
}
inline int min(int a, int b) { return a < b ? a : b; }
inline int max(int a, int b) { return ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
int n, m, K, T, dis[maxn][maxn], A, B, s[maxn], t[maxn];
int cnt, head[maxn], to[maxn * maxn], nex[maxn * maxn];
int tot[maxn], tmp[maxn], tp;
int stk[maxn], l;
bool bj[maxn][maxn];
int dp[maxn], DP[maxn], vis[maxn];
void add(int x, int y) {
to[++cnt... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int D[110][110], n, m, q, E[110];
vector<int> A[110][110];
int Res[110];
vector<int> M[110];
int CM[110][110];
int main() {
int i, j, v, nv, l, k, a, b, q, v1, v2;
bool fl = 1;
scanf("%d%d%d%d", &n, &m, &a, &b), a--, b--;
for (i = 0; i < n; i++)
for (j = 0; j < ... | ### Prompt
Develop a solution in cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int maxN = 105;
const int maxM = maxN * maxN;
const int INF = 0x3f3f3f3f;
int a[maxN][maxN];
int b[maxN][maxN];
int c[maxN][maxN];
int s[maxN];
int t[maxN];
int ans[maxN];
int g[maxN], f[maxN];
int N, M, S, T;
int cnt;
int dfs(int x, int y) {
if (g[x] == cnt) return... | ### Prompt
Generate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
int Get() {
char c;
while (c = getchar(), c < '0' || c > '9')
;
int X = 0;
while (c >= '0' && c <= '9') {
X = X * 10 + c - 48;
c = getchar();
}
return X;
}
const int inf = 1000000000;
int main() {
int N = Get(), M = Get(), S = Get() - 1, T = Get() ... | ### Prompt
Your task is to create a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int h[maxn], H[maxn][maxn], n, fi, se, m, qq, amad[maxn][maxn], dp[maxn],
Ans[maxn];
bool mad[maxn];
bool e[maxn];
pair<long long, long long> a[maxn];
queue<int> q;
vector<int> v[maxn], g[maxn], kh, ert[maxn][maxn];
void dfs(int i, int R) {
for (... | ### Prompt
In cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
inline char gc() {
static const long long L = 233333;
static char sxd[L], *sss = sxd, *ttt = sxd;
if (sss == ttt) {
ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
if (sss == ttt) {
return EOF;
}
}
return *sss++;
}
inline char readalpha() {
char c... | ### Prompt
Your task is to create a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
int g[105][105];
int n, m, S, T;
int d[105][105], cnt[105][105] = {0};
int U[105], V[105];
int nu;
int f[105][105];
int lef[105][105] = {0};
int vis[105][105] = {0};
int on(int u, int s, int t) {
if (d[s][u] + d[u][t] != d[s][t]) return 0;
if (cnt[s][u] * cnt[u][t] == c... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 109;
const int INF = 0x3f3f3f3f;
int m, n, a, b;
int dis[N][N];
int sv[N], tv[N], s, t;
vector<int> to[N];
bool reachable[N], tmp[N];
bool dfs(int now) {
if (reachable[now]) {
return true;
}
if (now == t) {
return false;
}
int siz = to[now].s... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int sum = 0;
char c = getchar();
bool f = 0;
while (c < '0' || c > '9') {
if (c == '-') f = 1;
c = getchar();
}
while (c >= '0' && c <= '9') {
sum = sum * 10 + c - '0';
c = getchar();
}
if (f) return -sum;
return sum;
}
... | ### Prompt
In Cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 100 + 10;
constexpr int MOD = 1e9 + 7;
int n, m, a, b, dist[N], main_dist[N][N], u, v, s[N], t[N], limit,
new_dist[N][N];
vector<int> node[N], bus[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >> a >>... | ### Prompt
Create a solution in Cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
int vis[105], T, num[105], dp[105], f[105][105], n, m, K, DP[105], s[105],
t[105];
bool b[105][105];
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int dfs(int u, int k) {
if (vis[u] == T) return DP[u];
int tmp = -1;
... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5;
const int inf = 1e9;
int f[N][N], n, m, A, B, nb;
int S[N], T[N];
vector<int> pss[N][N];
int res[N], t[N];
void relax(int &a, int b) {
if (a < b) a = b;
}
void upd(int &a, int b) {
if (a > b) a = b;
}
void floyd() {
for (int i = 1; i <= n; i++)
... | ### Prompt
Generate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int dist[maxn][maxn];
int d[maxn][maxn];
int used[maxn][maxn];
vector<vector<int> > es;
int bus[maxn][maxn];
int cnt[maxn];
int main() {
int n, m, a, b;
while (scanf("%d%d%d%d", &n, &m, &a, &b) >= 1) {
--a, --b;
es = vector<vector<int> >(n)... | ### Prompt
Develop a solution in cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& num) {
num = 0;
bool f = true;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = false;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
num = num * 10 + ch - '0';
ch = getchar();
}
... | ### Prompt
Create a solution in cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
int n, m, A, B, inf = 1e9, f[110][110], x, y, K, g[110][110], Cnt[110],
d[110][110];
bool vis[110][110], V[110][110], Must[110][110];
vector<int> E1[110], E2[110], E[110][110];
queue<pair<int, int> > h;
void read(int &x) {
char ch = getchar();
int mark =... | ### Prompt
Please formulate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
const int inf = INT_MAX / 4;
int n, m, k, s[MAXN], t[MAXN], d[MAXN][MAXN], a, b, h[MAXN], dp[MAXN][MAXN];
vector<int> maybe[MAXN], must[MAXN], adj[MAXN], nxt[MAXN][MAXN];
bool visit[MAXN];
inline void get() {
cin >> n >> m >> a >> b;
a--;
b--;
... | ### Prompt
Develop a solution in cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x03030303;
int n, m, dis[120][120], ans[120], x, y, i, j, k, s, t, q, tail[120], tmp[120],
f[120];
bool must[120][120], bo[120];
int dfs(int x, int t) {
if (x == t) return ans[t];
if (bo[x]) return f[x];
bo[x] = 1;
f[x] = 0;
for (int i = 1; i ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
vector<int> G1[maxn];
int n, m, a, b, q, mp[maxn][maxn], must[maxn][maxn], num[maxn];
int dist[maxn], vis[maxn], p[maxn], fb[maxn], tb[maxn], dp[maxn], Md[maxn];
struct Heap {
int u, d;
Heap(int _u = 0, int _d = 0) {
u = _u;
d = _d;
}
b... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int n, m, K, S, T, tot;
int f[110][110], num[110][110], go[110][110], s[110], t[110], Ans[110], Dp[110];
int Vis[110];
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 15;
int n, m, s, t, x, y, k;
int a[maxn][maxn];
int c[maxn][maxn];
int b[maxn][maxn];
int f[maxn];
int ls[maxn];
int xx[maxn], yy[maxn];
int vis[maxn], sum;
int done(int x, int y) {
if (vis[x] == sum) return ls[x];
vis[x] = sum;
int ans = -1;
... | ### Prompt
Please create a solution in Cpp to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') f = -f;
c = getchar();
}
while (isdigit(c)) {
x = x * 10 + c - '0';
c = getchar();
}
return x * f;
}
const int maxn = 1e2 + 5;
int vis[maxn], NOW, num... | ### Prompt
Construct a cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
const long long maxn = 1e2 + 10, maxm = 1e5 + 10, lg = 20, mod = 1e9 + 7,
inf = 1e18;
long long n, m, a, b, K, dp[maxn], pd[maxn];
vector<pair<long long, long long> > bus;
long long g[maxn]... | ### Prompt
Please provide a CPP coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int n, m, p, S, T;
int dis[105][105], tmp[105], vis[105], tme;
int ans[105], s[105], t[105], c[105][105], mark[105];
inline int rd() {
int x = 0, f = 1;
char ch = getchar();
while (ch > '9' || ch < '0') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch ... | ### Prompt
Generate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int f[N][N], ans[N], rp[N], S, T, s[N], t[N], n, m, k, vis[N], cho;
int must[N][N];
int ct[N][N];
int dfs(int x, int y) {
if (vis[x] == cho) return rp[x];
vis[x] = cho;
int res = -1;
for (int j = (1); j <= (int)n; j++)
if (f[x][j] == 1 && f[x]... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101, MAXM = 10001;
int n, m, S, T, s[MAXN], t[MAXN], vis[MAXN], dis[MAXN][MAXN], dp[MAXN], g[MAXN],
e, K;
bool pass[MAXN][MAXN];
int dfs(int u, int M) {
if (u == M) return dp[M];
if (vis[u]) return g[u];
vis[u] = 1;
g[u] = 0;
for (int i = 1; i... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T &a, S b) {
a += b;
if (a >= mod) a -= mod;
}
template... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int n, m, a, b;
int d[111][111];
int ans[111];
int k;
int s[111];
int t[111];
bool g[111][111];
int r[111];
int main() {
cin >> n >> m >> a >> b;
a--, b--;
for (int i = (0); i < (n); i++)
for (int j = (0); j < (n); j++) {
if (i == j)
d[i][j] = 0;
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int next, to;
} ed[10000 + 5];
int last[100 + 5], inf = 1e9, dp[100 + 5][100 + 5], dis[100 + 5][100 + 5],
s[100 + 5], t[100 + 5], n, m, q, ecnt = 0, a, b;
bool must[100 + 5][100 + 5], vis[100 + 5][100 + 5];
void add(int u, int v) {
ed[++... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
template <class Num>
inline void read(Num &x) {
char c;
int flag = 1;
while ((c = getchar()) < '0' || c > '9')
if (c == '-') flag = -1;
x = c - '0';
while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
x *= flag;
}
template <class Num>
inline voi... | ### Prompt
Your task is to create a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, c = getchar(), f = 0;
for (; c > '9' || c < '0'; f = c == '-', c = getchar())
;
for (; c >= '0' && c <= '9'; x = (x << 1) + (x << 3) + c - '0', c = getchar())
;
return f ? -x : x;
}
inline void write(int x) {
if (x < 0) putch... | ### Prompt
Construct a CPP code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, c = getchar(), f = 0;
for (; c > '9' || c < '0'; f = c == '-', c = getchar())
;
for (; c >= '0' && c <= '9'; x = (x << 1) + (x << 3) + c - '0', c = getchar())
;
return f ? -x : x;
}
inline void write(int x) {
if (x < 0) putch... | ### Prompt
Create a solution in Cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
int n, m, q, st, fn, dis[((int)105)][((int)105)];
int s[((int)105)], t[((int)105)], d[((int)105)][((int)105)],
out[((int)105)][((int)105)];
vector<int> vec[((int)105)][((int)105)];
bool change[((int)105)][((int)105)], mark[((int)105)][((int)105)];
deque<pair<int, int> >... | ### Prompt
Construct a CPP code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
int may[110][110][110];
int dis[110][110];
int app[110][110];
int n, m, a, b, k;
int s[110], t[110];
int cost[110][110], cnt[110][110];
int q1[10010], q2[10010], head, tail;
int h[110];
bool done() {
int i, j, s, val, flag = 0;
for (i = 1; i <= k; ++i)
for (j = 1; j <= n; ++j) {
f... | ### Prompt
Please formulate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 77;
int n, m, S, T, t, Es[N], Et[N], d[N][N], dp[N], f[N];
bool E[N][N];
vector<int> V[N];
int main() {
memset(d, 50, sizeof d);
memset(dp, 50, sizeof dp);
scanf("%d %d %d %d", &n, &m, &S, &T);
dp[T] = 0;
for (int i = 1; i <= n; ++i) d[i][i] = ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
const int MN = 105, INF = 200;
int n, m, dis[MN][MN], d[MN][MN], st[MN], fn[MN], mark[MN];
vector<int> good[MN], all[MN], vec[INF];
void floyd() {
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) dis[i][j] = INF;
for (int i = 0; i < n; i++) dis[i][i] = 0;
f... | ### Prompt
In Cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
int n, m, A, B, T, U[maxn], V[maxn];
int dis[maxn][maxn], pass[maxn][maxn];
int g[maxn], f[maxn];
bool vis[maxn];
bool OnRoad(int S, int x, int T) { return dis[S][x] + dis[x][T] == dis[S][T]; }
int dfs(int u, int T) {
if (u == T) return f[u];
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 201;
int n, m, num, cnt;
int a[maxn][maxn], b[maxn][maxn], S[maxn], T[maxn];
int ans[maxn], vis[maxn], dp[maxn], p[maxn][maxn];
int dfs(int u, int v) {
if (vis[u] == cnt) return dp[u];
vis[u] = cnt;
int Ans = -1;
for (int i = 1; i <= n; i++)
if ... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int n, m, A, B, inf = 1e9, f[110][110], x, y, K, g[110][110], Cnt[110],
d[110][110];
bool vis[110][110], V[110][110], Must[110][110];
vector<int> E1[110], E2[110], E[110][110];
queue<pair<int, int> > h;
void read(int &x) {
char ch = getchar();
int mark =... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int st, fin, n, m, i, j, k, q, kt;
int a[N][N], b[N][N][N], g[N][N], ta[N], tb[N], ans[N], v[N];
vector<int> u[N][N];
int main() {
scanf("%d%d%d%d", &n, &m, &st, &fin);
st--, fin--;
memset(a, 0, sizeof(a));
for (i = 0; i < m; ++i) {
int qs, qf... | ### Prompt
Construct a cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
int n, m, a, b;
int map[107][107];
int s[107], t[107];
int need[107][107];
int cnt[107], ans[107];
bool vis[107];
int tmp[107];
int f(int x, int y) {
if (vis[x] == 1) return tmp[x];
vis[x] = 1;
int now = -1;
for (int i = 1; i <= n; ++i) {
if (map[x][i] == 1 && map[x][t[y]] == map[i]... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 101;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long ger[maxn][maxn];
long long minn[maxn][maxn];
long long mint[maxn][maxn];
long long dp[maxn];
long long hazf[maxn];
long long n;
void del(long long a) {
hazf[a] = 1;
f... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int st, fin, n, m, i, j, k, q, kt;
int a[N][N], b[N][N][N], g[N][N], ta[N], tb[N], ans[N], v[N];
vector<int> u[N][N];
int main() {
scanf("%d%d%d%d", &n, &m, &st, &fin);
st--, fin--;
memset(a, 0, sizeof(a));
for (i = 0; i < m; ++i) {
int qs, qf... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
int n, m, A, B, T, U[maxn], V[maxn];
int dis[maxn][maxn], pass[maxn][maxn];
int g[maxn], f[maxn];
bool vis[maxn];
bool OnRoad(int S, int x, int T) { return dis[S][x] + dis[x][T] == dis[S][T]; }
int dfs(int u, int T) {
if (u == T) return f[u];
... | ### Prompt
Develop a solution in CPP to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int get() {
int f = 0, v = 0;
char ch;
while (!isdigit(ch = getchar()))
if (ch == '-') break;
if (ch == '-')
f = 1;
else
v = ch - '0';
while (isdigit(ch = getchar())) v = v * 10 + ch - '0';
if (f)
return -v;
else
return v;
}
const int max... | ### Prompt
Please formulate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int g[105][105];
int n, m, S, T;
int d[105][105], cnt[105][105] = {0};
int U[105], V[105];
int nu;
int f[105][105];
int lef[105][105] = {0};
int on(int u, int s, int t) {
if (d[s][u] + d[u][t] != d[s][t]) return 0;
if (cnt[s][u] * cnt[u][t] == cnt[s][t]) return 2;
ret... | ### Prompt
Develop a solution in CPP to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int INF = 1 << 25;
int n, m, s, t, T, dis[maxn][maxn], Dp[maxn], dp[maxn];
int A[maxn], B[maxn], cnt, vis[maxn], ss[maxn * 2];
bool b[maxn][maxn];
int dfs(int u, int k) {
if (vis[u] == cnt) return Dp[u];
int tmp = -1;
vis[u] = cnt;
for (i... | ### Prompt
Please formulate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 + 10;
int n, m, a, b, k, di[MAXN];
int Q_[MAXN], L_, R_;
bool mark[MAXN];
vector<int> pars[MAXN];
struct sp {
int len = 0;
vector<vector<int>> levels;
vector<int> cntl;
vector<int> distl;
vector<int> befor(int id) {
vector<int> rs;
for... | ### Prompt
Please formulate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int INF = 0x3f3f3f3f;
int n, m, a, b, t;
int from[maxn], to[maxn];
int dist[maxn][maxn];
int incur[maxn][maxn];
bool vis[maxn];
int g[maxn], f[maxn];
int dfs(int cur, int aim) {
if (cur == aim) return f[cur];
if (vis[cur] == true) return g[cu... | ### Prompt
In Cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int h[maxn], H[maxn][maxn], n, fi, se, m, qq, amad[maxn][maxn], dp[maxn],
Ans[maxn];
bool mad[maxn];
bool e[maxn];
pair<long long, long long> a[maxn];
queue<int> q;
vector<int> v[maxn], g[maxn], kh, ert[maxn][maxn];
void dfs(int i, int R) {
for (... | ### Prompt
Create a solution in cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 100 + 10;
constexpr int MOD = 1e9 + 7;
long long n, m, a, b, dist[N], main_dist[N][N], u, v, s[N], t[N], limit,
new_dist[N][N];
vector<int> node[N], bus[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m >... | ### Prompt
Generate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 111;
int st, fin, n, m, i, j, k, q, kt;
int a[N][N], b[N][N][N], g[N][N], ta[N], tb[N], ans[N], v[N];
vector<int> u[N][N];
int main() {
scanf("%d %d %d %d", &n, &m, &st, &fin);
st--;
fin--;
memset(a, 0, sizeof(a));
for (i = 0; i < m; i++) {
int q... | ### Prompt
Develop a solution in CPP to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int d[109][109], n, m, dis[109][109], must[109][109];
vector<int> Next[109][109], V[109];
int main() {
int a, b;
memset(d, 0x3f, sizeof(d));
scanf("%d%d%d%d", &n, &m, &a, &b);
for (int i = 1; i <= n; i++) d[i][i] = 0;
for (int i = 0; i ... | ### Prompt
Construct a CPP code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f, N = 105;
int n, m, k, cnt, fl[N], num[N], dp[N], dp2[N], s[N], t[N], f[N][N];
bool vis[N][N];
inline int dfs(int x, int k) {
if (fl[x] == cnt) return dp2[x];
int res = -1;
fl[x] = cnt;
for (int y = 1; y <= n; ++y)
if (f[x][y] == 1 && ... | ### Prompt
Generate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int inf = 0x3f;
const int MAXN = 105;
int g[MAXN][MAXN];
int s[MAXN], t[MAXN];
int D[MAXN], bs[MAXN];
bool can[MAXN][MAXN];
int main() {
int n, m, a, b, k;
scanf("%d%d%d%d", &n, &m, &a, &b);
--a, --b;
memset(g, inf, sizeof(g));
fo... | ### Prompt
Construct a Cpp code solution to the problem outlined:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned ... |
#include <bits/stdc++.h>
using namespace std;
int f[109][109], n, m, s, t, b_num, dp[109], vis[109], Dp[109], T;
map<int, int> mp;
struct bus {
int s, t;
int vis[109];
vector<int> q;
void st() {
memset(vis, 0, sizeof(vis));
int cnt = 0;
for (int now : q) vis[now] = f[s][now] + 1;
}
} b[109];
int d... | ### Prompt
Create a solution in cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
int d[200][200], b[200][200], n, m,
inf = 1e9, k, U[200], V[200], child[200][200], dp[200][200], S, T,
pd[200][200], A[50000], B[50000], way[200][200];
int onpath(int k1, int k2, int k3) {
if (d[k1][k2] + d[k2][k3] != d[k1][k3]) return 0;
if (way[k1][k2] * way[k... | ### Prompt
Generate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
int dis[105][105];
int n, m, S, T;
int tot[105], wz[105];
int q;
int p[105];
int st[105], en[105];
bool ok[105][105];
int ans[105];
int bz[105], totnum;
int f[105];
int dfs(int w, int to) {
if (bz[w] == totnum) return f[w];
bz[w] = totnum;
int ret = -1;
for (int i =... | ### Prompt
Develop a solution in Cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
vector<int> G1[maxn];
int n, m, a, b, q, mp[maxn][maxn], must[maxn][maxn];
int dist[maxn], vis[maxn], p[maxn], fb[maxn], tb[maxn], dp[maxn], Md[maxn];
struct Heap {
int u, d;
Heap(int _u = 0, int _d = 0) {
u = _u;
d = _d;
}
bool operato... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int B_INF = 0x3f;
const int MAXN = 105;
int g[MAXN][MAXN];
int s[MAXN], t[MAXN];
int ans[MAXN], bs[MAXN];
bool can[MAXN][MAXN];
int main() {
int n, m, a, b, k;
scanf("%d%d%d%d", &n, &m, &a, &b);
--a, --b;
memset(g, B_INF, sizeof(g))... | ### Prompt
Generate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
const int INF = 0x3f3f3f3f;
int n, m, a, b, t;
int from[maxn], to[maxn];
int dist[maxn][maxn];
int incur[maxn][maxn];
bool vis[maxn];
int g[maxn], f[maxn];
int dfs(int cur, int aim) {
if (cur == aim) return f[cur];
if (vis[cur] == true) return g[cu... | ### Prompt
Please formulate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
int vis[105], T, num[105], Dp[105], f[105][105], n, m, dp[105], s[105], t[105];
bool b[105][105];
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int dfs(int u, int k) {
if (vis[u] == T) return Dp[u];
int tmp = -1;
vis[u] = T;
for (int v =... | ### Prompt
Develop a solution in Cpp to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265359;
template <typename T>
T abs(T x) {
return x > 0 ? x : -x;
}
template <typename T>
T sqr(T x) {
return x * x;
}
template <typename T>
void chmin(T &x, T y) {
x = min(x, y);
}
template <typename T>
void chmax(T &x, T y) {
x = max(... | ### Prompt
Your task is to create a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool updmn(T& A, const T& B) {
return A > B ? A = B, 1 : 0;
}
template <typename T>
bool updmx(T& A, const T& B) {
return A < B ? A = B, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const int maxn = 110;
const int maxb = 110;
int n, m, S, T;
int G[maxn][ma... | ### Prompt
Your task is to create a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long INF = 1e18;
const int maxn = 110;
int S[maxn], T[maxn], b[maxn][maxn], d[maxn][maxn], f[maxn], g[maxn], h[maxn];
vector<int> G[maxn][maxn];
int main() {
int n, m, s, t;
scanf("%d%d%d%d", &n, &m, &s, &t);
s--;
t--;
for (int i = ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int dist[maxn][maxn];
int d[maxn][maxn];
int used[maxn][maxn];
vector<vector<int> > es;
int bus[maxn][maxn], onlybus[maxn][maxn];
int cnt[maxn];
int main() {
int n, m, a, b;
while (scanf("%d%d%d%d", &n, &m, &a, &b) >= 1) {
--a, --b;
es = ve... | ### Prompt
Please create a solution in cpp to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int MN = 105, INF = 200;
int n, m, dis[MN][MN], d[MN][MN], st[MN], fn[MN], mark[MN];
vector<int> good[MN], all[MN], vec[INF];
void floyd() {
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) dis[i][j] = INF;
for (int i = 0; i < n; i++) dis[i][i] = 0;
f... | ### Prompt
In Cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
const int inf = 1e8;
vector<int> adj[N], vec[N], g[N][N];
int dis[N][N], dp[N][N], cnt[N];
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int n, m, a, b;
cin >> n >> m >> a >> b;
a--;
b--;
for (int i = 0; i < n; i... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
using namespace std;
const long long N = 200, OO = 1e9 + 7, T = 1e6 + 10, mod = 1e9 + 7, P = 6151,
SQ = 280, lg = 70;
long long dis[N], s[N], t[N], dp[N][N], dk[N];... | ### Prompt
Please provide a cpp coded solution to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, S, T, x, y, num;
int a[110][110], b[110][110], s[110], t[110], an[110], h[110], f[110],
c[110][110];
int dfs(int x, int y) {
if (h[x] == num) return f[x];
h[x] = num;
int i, ans = -1;
for (i = 1; i <= n; i++)
if (a[x][i] == 1 && a[x][i] + ... | ### Prompt
Develop a solution in CPP to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int inf = 1e9;
int dist[111][111];
bool must[111][111];
int ans[111];
int from[111], to[111];
int f[111];
bool vis[111];
int n, m, q, s, t;
int dfs(int x, int y) {
if (x == y) return ans[y];
if (vis[x]) return f[x];
vis[x] = 1;
f[x] = 0;
for (int i = 1; i <= n; i+... | ### Prompt
In Cpp, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
int dis[111][111], dp[111][111];
vector<int> g[111], bus[111];
int bx[111], by[111], m, n, t, src, des;
bool pass[111][111];
int main() {
int u, v;
scanf("%d%d%d%d", &n, &m, &src, &des);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (i != j) d... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e2 + 10;
const long long INF = 1e9 + 10;
vector<long long> dag[MAXN][MAXN];
vector<long long> f[MAXN];
vector<long long> e[MAXN];
vector<long long> in[MAXN];
vector<long long> out[MAXN];
queue<long long> q;
long long s[MAXN];
long long t[MAXN];
long ... | ### Prompt
Generate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#include <bits/stdc++.h>
using namespace std;
vector<int> u[101][101];
int dis[101][101];
int fr[101], to[101];
int ans[101], c[101];
int main() {
int n, m, a, b;
scanf("%d%d%d%d", &n, &m, &a, &b);
memset(dis, 0x23, sizeof(dis));
memset(ans, 0x23, sizeof(ans));
for (int i = 0; i < m; i++) {
int u, v;
... | ### Prompt
Please formulate a CPP solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4, M = 1e5;
int gi() {
int w = 0;
bool q = 1;
char c = getchar();
while ((c < '0' || c > '9') && c != '-') c = getchar();
if (c == '-') q = 0, c = getchar();
while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
return q ? w : -w;
}... | ### Prompt
Your task is to create a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110, INF = 1e9;
long long n, m, a, b, k, s[maxn], t[maxn], dist[maxn][maxn], dis[maxn],
ans[maxn];
vector<int> vec[maxn], edges[maxn];
queue<int> q;
bool mark[maxn], vis[maxn];
inline void setdist() {
for (int i = 0; i < maxn; ++i) {
for (int j = ... | ### Prompt
Your task is to create a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
int n, m, g[1100][1100], S, T, s[1100], t[1100], dp[1100], cnt[1100], Ans[1100];
bool cut[1100][1100], vis[1100];
inline int read() {
int x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 1e2 + 5;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
return (!b ? 1
: (b & 1 ? (a * pw(a * a % ... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the dat... |
#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, k, d[111][111], s[111], t[111], r[111], now, seen, used[111];
bool must[111][111];
int main() {
cin >> n >> m >> a >> b;
a--, b--;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j) d[i][j] = 1000000000;
for (int i = 0; i <... | ### Prompt
Please formulate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int inf = 1 << 29;
int dis[maxn][maxn];
int s[maxn], t[maxn];
int a, b, n, m, p, f[maxn], g[maxn];
vector<int> juc[maxn][maxn];
bool judge(int u, int v, int w) { return dis[u][v] == dis[u][w] + dis[w][v]; }
int main() {
scanf("%d %d %d %d", &n,... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
bool fu = 0;
char c;
for (c = getchar(); c <= 32; c = getchar())
;
if (c == '-') fu = 1, c = getchar();
for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
if (fu) x = -x;
};
template <class T>
inline void rea... | ### Prompt
Develop a solution in CPP to the problem described below:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
const int N = 109;
int a, b, n, m, f[N][N], dp[N][N], ways[N][N], s[N], q[N * N][2], deg[N][N],
t[N];
bool inq[N][N];
inline int onpath(int x, int s, int t) {
if (f[s][x] + f[x][t] != f[s][t]) return 0;
return 1 + (ways[s][x] * ways[x][t] == ways[s][t]);
}
int main() {
scanf("%d%d%d%d... | ### Prompt
Please create a solution in CPP to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
#include <bits/stdc++.h>
using namespace std;
int g[105][105];
int n, m, S, T;
int d[105][105], cnt[105][105] = {0};
int U[105], V[105];
int nu;
int f[105][105];
int lef[105][105] = {0};
int vis[105][105] = {0};
int on(int u, int s, int t) {
if (d[s][u] + d[u][t] != d[s][t]) return 0;
if (cnt[s][u] * cnt[u][t] == c... | ### Prompt
Your task is to create a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is... |
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 105, inf = 999999999 + 208;
int n, m, st, en, dist[Maxn][Maxn];
int aim[Maxn], tot;
int f[Maxn], g[Maxn];
bool iscut[Maxn][Maxn], visi[Maxn];
int dfs(int cur, int aim) {
if (cur == aim) return f[cur];
if (visi[cur]) return g[cur];
visi[cur] = 1;
g[c... | ### Prompt
Generate a Cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in a ... |
#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;
for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar())
;
n = c - '0';
for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '... | ### Prompt
Create a solution in Cpp for the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in ... |
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int INF = 1e8;
int n, m, start, fin;
int d[N][N], en[N];
int cnt[N], dp[N][N];
bool has[N][N];
bool must[N][N];
vector<int> out[N];
int main() {
scanf("%d%d%d%d", &n, &m, &start, &fin);
memset(d, 63, sizeof d);
for (int i = 1; i <= n; i++) d[i... | ### Prompt
In CPP, your task is to solve the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is planned in... |
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100 + 10, INF = ~0U >> 3;
const int MOD = int(1e9) + 7;
int n, m, vs, vt;
int dist[MAX_N][MAX_N], cnt[MAX_N][MAX_N];
int nB;
int st[MAX_N], ed[MAX_N];
bool e[MAX_N][MAX_N];
int dp[MAX_N][MAX_N];
bool mustPass(int u, int v, int mid) {
return dist[u][mid] ... | ### Prompt
Please formulate a cpp solution to the following problem:
Urpal lives in a big city. He has planned to meet his lover tonight.
The city has n junctions numbered from 1 to n. The junctions are connected by m directed streets, all the roads have equal length. Urpal lives in junction a and the date is plann... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.