output stringlengths 52 181k | instruction stringlengths 296 182k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
const int N = 11;
const int INF = 1e9;
const int SIZE = 2 * N * N;
struct edge {
int to, c, first, rev;
edge() {}
edge(int too, int cc, int ff, int revv) {
to = too;
c = cc;
first = ff;
rev = revv;
}
};
vector<edge> g[SIZE];
int d[SIZE], ptr[SIZE], s... | ### Prompt
In Cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int d[400][400], f[400][400], c[400][400], dd[400], n, t, g[400][400],
k[400][400];
vector<int> a[400];
deque<pair<int, int> > s;
bool kt(int x, int y) { return (x <= n && y <= n && x >= 1 && y >= 1); }
bool timluong(i... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
char ch[11][11];
int dtm[11][11];
int ctm[11][11];
int n, t, m;
inline bool ok(int i, int j) {
return (i >= 0 && i < n && j >= 0 && j < m && isdigit(ch[i][j]));
}
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
map<pair<int, int>, int> nums;
int c[222][222];
int S, T;... | ### Prompt
Please formulate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int INF = 1e9;
int n, t;
int damX, damY;
int cap[20][20], sci[20][20], lev[20][20][20][20];
void Bfs(int sX, int sY) {
queue<pair<bool, pair<int, int> > > q;
int infec[12][12], vis[12][12];
for (int i = 0; i < n; ++i) {
for (int j = 0... | ### Prompt
In cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
struct Edge {
int a, b, cap, flow;
};
struct MaxFlow {
int n, s, t;
vector<int> d, ptr, q;
vector<Edge> e;
vector<vector<int> > g;
MaxFlow(int n) : n(n), d(n), ptr(n), g(n), q(n) {
e.clear();
for (int i = 0, _a = (n); i < _a; ... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e14;
const long long mod = 1e9 + 7;
struct Dinic {
struct edge {
int to, rev;
long long first, cap;
};
vector<vector<edge>> g;
vector<int> dist, work, q;
Dinic(int n) : dist(n), work(n), q(n), g(n) {}
int dst, src;
void add(int u... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:264777216")
int n, T;
char sc[10][10];
char kap[10][10];
bool isFree[62][10][10];
int d[10][10][10][10];
struct tpo {
int v;
int f;
int c;
int ind;
};
const int size = 1000;
vector<tpo> gr[size];
void add(int u, int v, int c) {
tpo ... | ### Prompt
Your task is to create a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 15;
const int maxm = 1e6 + 15;
const int inf = 0x3f3f3f3f;
const int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int n, t, sx, sy;
char g[15][15];
int scientist[15][15], capsule[15][15];
int block[15][15], dis[15][15], kyori[15][15];
namespace dinic {
str... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
class Dinic {
struct edge {
int u, v, f, c, nx;
edge() {}
edge(int u, int v, int f, int c, int nx) : u(u), v(v), f(f), c(c), nx(nx) {}
} e[256 * 256];
int n, m, src, dst, head[256], work[256], d[256];
bool _bfs() {
static int q[256], le, ri;
le =... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
int n, t;
string A[11];
string B[11];
inline bool isNum(char ch) { return ch >= '0' && ch <= '9'; }
char BAD = 'Z';
char WALL = 'Y';
const int SSIZE = 1000;
vector<int> KEK[11][11];
vector<int> H[11][11];
bool possible[11][11][11][11];
bool HELP[11][11];
string getS[SSIZE];... | ### Prompt
Please formulate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
int a[20][20], b[20][20], a1[20][20], b1[20][20];
int n, tim, x2, y2;
vector<pair<int, int> > t;
void next(int x) {
if (x == 0) return;
t.clear();
for (int i = 0; i < n;... | ### Prompt
Develop a solution in Cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int maxm = 450000;
const int maxn = 51000;
const int inf = 0x7fffffff / 100;
struct graph {
struct edge {
int v, flow, c, next;
} a[maxm * 4];
int tot, start[maxn], n, m, s, t;
inline void init(int _n) {
n = _n;
memset(start, -1, sizeof(start));
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10;
const int INF = 1e9;
int n, t;
int damX, damY;
int cap[20][20], sci[20][20], lev[20][20][20][20];
void Bfs(int sX, int sY) {
queue<pair<bool, pair<int, int> > > q;
int infec[12][12], vis[12][12];
for (int i = 0; i < n; ++i) {
for (int j = 0... | ### Prompt
Develop a solution in CPP to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
struct FlowEdge {
int v, u;
long long cap, flow = 0;
FlowEdge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
const long long flow_inf = 1e18;
vector<FlowEdge> edges;
vector<vector<int>... | ### Prompt
Develop a solution in Cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const long long inf = 1e17 + 7;
const long long max_n = 1001;
long long xdir[]{0, 0, -1, 1}, ydir[]{-1, 1, 0, 0};
vector<long long> gr[max_n];
bool used[max_n];
long long pa[max_n];
bool check(lon... | ### Prompt
Please create a solution in cpp to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int M = 10;
const int inf = 1000;
const int D = 9;
const int V = (M * M - 1) * D * 2 + 2;
int n, t;
int dist[M][M];
int fireTime[M][M];
bool visited[M][M];
char scholar[M][M];
char capsule[M][M];
int minTime[M][M][M][M];
bool canReach[M][M][M][M];
int source;
int sink... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int total = 0, p[20000], n, t, lf[20][20], rg[20][20], d[20][20],
poison[20][20], q[200000], dist[20000];
string a[20], b[20];
struct edge {
int a, b, c, f;
};
vector<edge> e;
vector<int> g[20000];
void add_edge(int a,... | ### Prompt
In Cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
const long long INF = (long long)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const double PI = acos(-1.0);
const double eps = 1e-6;
const long long mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int maxn = 500 + 10;
const int maxm = 100 + 10;
using namespace std;
int n, m, k;
int danger[12][12... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int MAXN = 500;
struct edge {
int a, b, cap, flow;
};
bool m[11][11];
vector<int> g[MAXN];
vector<edge> e;
int d[MAXN], ptr[MAXN], n, xb, yb, t, temp[11][11], kaps[11][11];
int way(int x1, int Y1, int x2, int y2) {
queue<pair<int, pair<int... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
char s[11][11];
char c[11][11];
bool infect[100][11][11];
bool mark[100][11][11];
int G[300][300];
int d[300];
int num[300];
int pre[300];
int flow[300];
int n;
int SAP() {
int ans, i, j;
ans = 0;
memset(num, 0, sizeof(num));
memset(d, 0, sizeof(d));
i = 0;
pre[... | ### Prompt
Please formulate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 100000010;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int n, t;
bool bad[11][11];
int d[11][11];
int matched[20000];
bool visited[20000];
vector<int> graph[20000];
vector<pair<int, int> > scie;
vector<pair<int, int> > caps;
pair<int, int> bomb;
bool... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
inline int in() {
int32_t x;
scanf("%d", &x);
return x;
}
inline string get() {
char ch[1001000];
scanf("%s", ch);
return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
if (b < a) a = b;
return a;
}
template <class P, class Q>
inline P smax(P &... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class T>
T abs(T x) {
return x > 0 ? x : -x;
}
int n;
int m;
int col1[10][10], col2[10][10];
int matr[10][10];
int dist[10][10];
int dist2[10][10][10][10];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
void bfs1... | ### Prompt
Generate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
int N, T;
char grid1[12][12], grid2[12][12];
int A[12][12];
int B[12][12][12][12];
int depth[12][12];
struct edge {
int a, b, cap, flow;
};
int n, s, t, d[205], ptr[205], q[205];
vector<edge> e;
vector<int> g[205];
voi... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
const int c[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int S, T, tot = 1, n, tt, inf, b[1000], q[1000000], a[1000000][3], dep[20][20],
dis[20][20], p[20][20], s[20][20];
char ma[20][20], mb[20][20];
void add(int x, int y, int c) {
a[++tot][0] = y, a[tot][1] = c... | ### Prompt
In CPP, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << "\n";
err(++it, args...);
}
const double PI = acos(-1);
const double eps = (1e-9);
const long long in... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 7007;
const int MAXM = 300007;
const int INF = 1 << 29;
const int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
char reactor[15][15], rescue[15][15];
int N;
int table[15][15];
bool isIn(int x, int y) { return x >= 1 && y >= 1 && x <= N && y <= N; }
struct ... | ### Prompt
Please provide a CPP coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int l[25000], r[25000], u[25000], was[25000], S;
vector<int> matom[15][15];
vector<int> matrec[15][15];
int x, y;
int k = 1;
int L, K, R;
vector<int> g[101010];
vector<pair<int, int> > om;
vector<pair<int, int> > rec;
queu... | ### Prompt
Develop a solution in CPP to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
class Hungary {
public:
static const int SIZE = 2000;
int cnt, pos[SIZE], rev[SIZE];
int gao(int n, vector<int> e[]) {
cnt = 0;
memset(pos, 255, sizeof(pos));
memset(rev, 255, sizeof(rev));
for (int i = 0; i < n; i++) {
memset(v, 0, sizeof(v));
... | ### Prompt
Please create a solution in CPP to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
const long long xx[] = {0, +1, 0, -1, 0}, yy[] = {+1, 0, -1, 0, 0};
long long n, t, S, T, id[15][15][65], dis[15][15], ncnt, ecnt, head[20005],
cur[20005], DIS[20005];
char a[15]... | ### Prompt
Generate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int MAXN = 500 + 5;
const int MAXM = 2000000 + 5;
const int INF = 1000000009;
int ned, first[MAXN], work[MAXN];
int cap[MAXM], to[MAXM], nxt[MAXM], dist[MAXN];
void init() {
memset(first, -1, sizeof first);
ned = 0;
}
void add(int u, int v, in... | ### Prompt
Develop a solution in cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
struct arc {
int f, s, c, prev;
} arr[500005];
int beg[8005], kol = 0;
void add_arc(int f, int s, int cap) {
arr[kol].f = f;
arr[kol].s = s;
arr[kol].c = cap;
arr[kol].prev = beg[f];
beg[f] = kol++;
arr[kol].f = s;
arr[kol].s = f;
arr[kol].c = 0;
arr[kol... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
class Dinic {
struct edge {
int u, v, f, c, nx;
edge() {}
edge(int u, int v, int f, int c, int nx) : u(u), v(v), f(f), c(c), nx(nx) {}
} e[256 * 256];
int n, m, src, dst, head[256], work[256], d[256];
bool _bfs() {
static int q[256], le, ri;
le =... | ### Prompt
Your task is to create a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
#pragma GCC optimize("O3")
using namespace std;
const int MOD = 1000000007;
const int INF = 1000000007LL;
const long long INF2 = 1000000007LL * 1000000007LL;
const long double EPS = 1e-4 / 2;
const int SIZE = 200100;
mt19937 rng(time(0));
uniform_in... | ### Prompt
Develop a solution in Cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2000 * 1000 * 1000;
const int MAXN = 210;
const int MAXM = 2 * MAXN * MAXN;
const int dx[] = {1, 0, 0, -1};
const int dy[] = {0, 1, -1, 0};
const int second = MAXN... | ### Prompt
Your task is to create a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20 + 5;
const double EPS = 1e-9;
const long long INF = 1000000000 + 5;
const int MAXN2 = 1e3 + 5;
char s[MAXN][MAXN];
char s2[MAXN][MAXN];
int dp[MAXN][MAXN][MAXN][MAXN];
int dp2[MAXN][MAXN];
bool visited[MAXN][MAXN];
int dx[4] = {0, 0, 1, -1};
int dy[4] = ... | ### Prompt
Please formulate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
struct FlowEdge {
int v, u;
long long cap, flow = 0;
FlowEdge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
const long long flow_inf = 1e18;
vector<FlowEdge> edges;
vector<vector<int>... | ### Prompt
Your task is to create a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
int now[70000], mm[70000];
struct node {
int x, c, y;
};
vector<node> net[70000];
int d[70000];
int n;
int minn(int x, int y) { return x < y ? x : y; }
int findnext(int x) {
int i;
for (i = now[x]; i < mm[x]; i++, now[x]++)
if (d[net[x][i].x] + 1 == d[x] && net[x]... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
struct node {
int r, c, dis;
};
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
queue<node> q;
char s[15];
int n, n1, m, lim, tot, p, a[11][11], b[11][11], d0[11][11], f[202][202],
d[202][202], w[202], h[202], g[203];
bool t, flag, ok[12][12], okb[12][12];
voi... | ### Prompt
Create a solution in CPP for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
inline int in() {
int32_t x;
scanf("%d", &x);
return x;
}
inline string get() {
char ch[1001000];
scanf("%s", ch);
return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
if (b < a) a = b;
return a;
}
template <class P, class Q>
inline P smax(P &... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
int n, t;
char grid1[11][11], grid2[11][11];
int c_id[11][11], cap_id[11][11];
int dist[2][11][11];
bool valid(int a, int b, int x, int y, bool reactor) {
bool ret = a + x >= 0 && a + x < n && b + y >= 0 && b + y < n &&
grid1[a + x][b + y] >= '0' && grid1[a +... | ### Prompt
Develop a solution in CPP to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int N = 12;
const int dirX[] = {0, -1, 0, 1};
const int dirY[] = {1, 0, -1, 0};
int n, t;
char a[N][N], b[N][N];
int used[N][N], cnt;
int h[N][N];
pair<int, int> q[N * N];
int top;
bool dp[N][N][N][N];
void bfsFindTime(int xx, int yy) {
top = 1;
q[0] = make_pair(x... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5000;
const long double eps = (1e-12);
const int logn = 21;
const double Pi = acos(-1.0);
const long long pp = 1000000000 + 7;
int lowbit(int x) { return x & (-x); }
const int INF = 1e9;
int n, t;
int idx(int x, int y) { return (x - 1) * n + y; }
pair... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
struct edge {
int v, rev, cap, flow;
edge(int _v, int _rev, int _cap, int _flow) {
v = _v;
rev = _rev;
cap = _cap;
flow = _flow;
}
edge() {}
};
vector<pair<int, int> > path;
vector<vector<edge> > AdjList;
int f = 0;
void addEdge(int u, int v, int cap... | ### Prompt
Create a solution in CPP for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
struct node {
int r, c, t;
node() {}
node(int _r, int _c, int _t) {
r = _r;
c = _c;
t = _t;
}
} cur;
struct flow_graph {
int MAX_V, E, s, t, head, tail;
int *cap, *to, *next, *last, *dist, *q, *now;
flow_graph() {}
flow_graph(int V, int MAX_E) {
... | ### Prompt
Your task is to create a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int v, w;
} edge[21000];
int adj[21000], head[210], e;
void addedge(int u, int v, int w) {
edge[e].v = v;
edge[e].w = w;
adj[e] = head[u];
head[u] = e++;
edge[e].v = u;
edge[e].w = 0;
adj[e] = head[v];
head[v] = e++;
}
int S, T;
int dist[210]... | ### Prompt
In Cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000;
int infected[14][14];
char grid[14][14];
char grid2[14][14];
int can[14][14][14][14];
int n, t;
void fillI(int i, int j, int n) {
infected[i][j] = 1;
int cnt = 2;
while (true) {
int flag = false;
for (int x = 0; x < n; x++) {
... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int maxm = 450000;
const int maxn = 51000;
const int inf = 0x7fffffff / 100;
struct graph {
struct edge {
int v, flow, c, next;
} a[maxm * 4];
int tot, start[maxn], n, m, s, t;
inline void init(int _n) {
n = _n;
memset(start, -1, sizeof(start));
... | ### Prompt
Please formulate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
struct edge {
int from, to;
int cap, flow;
edge(int from, int to, int cap, int flow = 0)
: from(from), to(to), cap(cap), flow(flow) {}
};
struct PushRelabel {
int N;
vector<edge> edges;
vector<vector<int>... | ### Prompt
Please create a solution in CPP to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
const int INF_INT = 0x3f3f3f3f;
const long long INF_LL = 0x7f7f7f7f;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
using namespace std;
int n, t;
char mp1[11][11], mp2[11][11];
vector<pair<int, int> > people, capsule;
int sx, sy;
int times[11][11];
int dir[4][2]... | ### Prompt
Please formulate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
long long INF = numeric_limits<long long>::max();
class max_flow {
static const long long INF = numeric_limits<long long>::max();
struct edge {
int t;
unsigned long rev;
long long cap, f;
};
vector<edge> adj[400];
int dist[400];
int ptr[400];
bool ... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int u, v, c, f;
int next;
};
struct MaxFlow {
int n, s, t;
vector<Edge> edges;
vector<int> head, current, h, avail;
vector<long long> excess;
MaxFlow(int n)
: n(n), head(n, -1), current(n, -1), h(n), avail(n), excess(n) {
edges.clear();... | ### Prompt
Generate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
bool debug;
const int inf = 1e9 + 5;
const int nax = 205;
namespace Flow {
int odl[nax], q[nax];
int m[nax][nax];
vector<int>::iterator pocz[nax];
vector<int> v[nax];
void init(int n) {
for (int i = 0; i <= n; ++i) v[i].clear();
for (int i = 0; i <= n; ++i)
for (int... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 + 10;
const int inf = 0x3f3f3f3f;
struct SAP {
int cap[MAXN][MAXN], flow[MAXN][MAXN], g[MAXN][MAXN];
int n;
int h[MAXN], vh[MAXN], source, sink;
int mk[MAXN];
void init(int n) {
this->n = n;
memset(cap, 0, sizeof(cap));
memset(g, 0... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 10 + 5, inf = 1e9 + 5;
int n, boom;
char sci[N][N], cap[N][N];
int id[N][N];
pair<int, int> reactor;
int dr[] = {-1, 0, 1, 0};
in... | ### Prompt
Please create a solution in Cpp to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 10005;
const int inf = 1 << 30;
struct node {
int u, v, c, next;
} g[MAX * 10];
struct Node {
int x, y, step;
};
int adj[MAX], dis[MAX], cur[MAX], pre[MAX], num[MAX], n, e, s, t, vn, T;
int sx, sy, dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int flag[15][15]... | ### Prompt
Please formulate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
using ld = long double;
template <class T>
using Table = vector<vector<T>>;
const ld eps = 1e-9;
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> v) {
os << "( " << v.first << ", " << v.second << ")";
return o... | ### Prompt
Please create a solution in CPP to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
map<int, int> edge[7000];
char buf[20][20];
int n, m, vn, from[7000], flow[7000], tox[10][10];
inline int aug(int s, int t, int cap) {
int result = 0;
for (int aug = 1; aug--;) {
for (int i = vn; i--;) from[i] = -1;
from[s] = s;
flow[s] = cap;
queue<int>... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
int n, timetodie;
char A[13][13], B[13][13];
int a[256][256], S, T, V;
bool b[256];
bool dfs(int x) {
b[x] = true;
for (int y = 0; y < S; ++y)
if (a[x][y] && (!b[y] && dfs(y) || y == T)) {
--a[x][y];
++a[y][x];
return true;
}
return false;
}
... | ### Prompt
Your challenge is to write a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int INFMEM = 63;
const int INF = 1061109567;
const long long LINF = 4557430888798830399LL;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[8] = {0,... | ### Prompt
Construct a CPP code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int v, cap, next;
} edge[500009];
char s1[19][19], s2[19][19];
int d[19][19], vis[19][19];
int N, T, tot;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int h[10009], gap[10009], des, src, head[10009], n;
void bfs(int X, int Y) {
queue<pair<int, int> > q;... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 300;
struct edge {
int to;
int nxt;
int C;
edge() {}
edge(int a, int b, int c) : to(a), nxt(b), C(c) {}
};
int headg[MAX], ent;
int headr[MAX], entr;
edge edgesr[(10030 << 1) + 500], edgesg[(10030 << 1) + 500];
map<pair<int, int>, int> mm, mm2;
int... | ### Prompt
Your challenge is to write a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int N = 11;
const int INF = 1e9;
const int SIZE = 2 * N * N;
struct edge {
int to, c, first, rev;
edge() {}
edge(int too, int cc, int ff, int revv) {
to = too;
c = cc;
first = ff;
rev = revv;
}
};
vector<edge> g[SIZE];
int d[SIZE], ptr[SIZE], s... | ### Prompt
Develop a solution in cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int N = 11, inf = 1e9, M = 999;
int n, t, xZ, yZ, sd = 4, uksc, ukkap;
int sci[N][N], dfZ[N][N], dn[N][N];
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};
vector<int> g[M], kap[N][N];
bool chp(int x, int y) {
return x >= 0 && y >= 0 && x < n && y < n && sci[x]... | ### Prompt
In Cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <class T>
void show(const vector<T> &a) {
for (T x : a) cout << x << " ";
cout << '\n';
}
const long long N =... | ### Prompt
Develop a solution in cpp to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
const int MAXM = 65536;
inline int RE(int i) { return i ^ 1; }
struct Edge {
int v;
int c;
};
struct FlowNetwork {
int n, m, source, sink;
vector<int> e[MAXN];
Edge edge[MAXM * 2];
void init(int n, int source, int sink) {
this->n = n;
... | ### Prompt
Generate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1.01e9;
struct Edge {
int to, cap, flow;
};
struct Graph {
int n;
vector<vector<int>> e;
vector<Edge> edges;
vector<int> d, c;
int t;
Graph() {}
Graph(int _n) {
n = _n;
e.resize(n);
}
void addEdge(int from, int to, int cap) {... | ### Prompt
Please create a solution in CPP to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 300 + 10, maxm = 4e4 + 10;
const int dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0};
const int INF = 0x3f3f3f3f;
struct Graph {
int ndn, edn, last[maxn];
int u[maxm], v[maxm], flw[maxm], cap[maxm], nxt[maxm]... | ### Prompt
In CPP, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
void execute();
int main() {
ios::sync_with_stdio(false);
execute();
}
int n, m;
char buf[20][20];
int toxic[10][10];
int verts;
map<int, int> edge[7000];
int from[7000];
int flow[7000];
inline int augment(int s, int t, int cap) {
int result = 0;
for (int aug = 1; a... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int maxn = 15;
const int maxm = 65;
const int maxt = 105;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
namespace MaxFlow {
struct Edge {
int to, rev, cap;
Edge(int to, int rev, int cap) : to(to), rev(rev), cap(cap) {}
... | ### Prompt
Your challenge is to write a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int N = 11 * 11 * 66;
const int INF = 0x3f3f3f3f;
const int M = N * 6;
struct Edge {
int v, next, cap;
Edge() {}
Edge(int v, int next, int cap) : v(v), next(next), cap(cap) {}
} e[M * 2];
int head[N], total;
void init() {
memset(head, -1, sizeof(head));
tota... | ### Prompt
Please create a solution in Cpp to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
const int M = 2001;
const int INF = 1e9;
const int X[] = {-1, 0, 1, 0};
const int Y[] = {0, 1, 0, -1};
int n, t, caps;
char scy[N][N];
char cap[N][N];
int r_dist[N][N];
int s_dist[N][N];
int c_id[N][N][10];
int s_id[N][N][10];
vector<int> graph[M];
bool va... | ### Prompt
Your task is to create a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
char a[11][11], b[11][11];
int n, t, fx, fy, d[11][11][11][11], u = 0, v = 0, c[1111][1111], cc[1111];
int aa[1111], bb[1111], dd[1111], tmp, ux[1111], uy[1111], vx[1111], vy[1111];
vector<pair<int, int> > q;
void bf... | ### Prompt
Please formulate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
char forbid[62][12][12];
char ma[12][12];
int cap[12][12], kexue[12][12];
int g[12 * 12][12 * 12], tk[12 * 12], tc[12 * 12], id[12][12], dist[12][12], n,
maxt;
int K, C;
inline int ok(int x, int y) { return... | ### Prompt
Construct a CPP code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
inline int in() {
int32_t x;
scanf("%d", &x);
return x;
}
inline string get() {
char ch[1001000];
scanf("%s", ch);
return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
if (b < a) a = b;
return a;
}
template <class P, class Q>
inline P smax(P &... | ### Prompt
Generate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 10;
struct fedge {
long long v, u;
long long cap, flow = 0;
fedge(long lo... | ### Prompt
In cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
const int di[] = {-1, 1, 0, 0};
const int dj[] = {0, 0, 1, -1};
const int MAXN = 15;
int N, T;
char c[MAXN][MAXN];
int sv[MAXN][MAXN], sc[MAXN][MAXN];
int badTime[MAXN][MAXN];
bool used[MAXN][MAXN];
int si, sj;
int num[MAXN][MAXN];
queue<pair<int, int> > Q;
queue<int> qt;
s... | ### Prompt
Develop a solution in CPP to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
char c[15][15];
char g[1000][1000];
vector<int> v[2][15][15];
queue<pair<int, int> > qq;
int tt[15][15], tt1[15][15], n, nn[2];
int mt[1000], used[1000];
void set_tt(int i0, int j0) {
int i, j, i1, j1;
qq.push(make_pair(i0, j0));
while (!qq.empty()) {
i0 = qq.fron... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 10 + 5, inf = 1e9 + 5;
int n, boom;
char sci[N][N], cap[N][N];
int id[N][N];
pair<int, int> reactor;
int dr[] = {-1, 0, 1, 0};
in... | ### Prompt
Create a solution in CPP for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma comment(linker, "/STACK:210000000")
using namespace std;
const int INF = 2e9 + 9;
const long long INF1 = 8e15 + 9;
const long long MAXN = 2e5 + 7;
const long long MAXN1 = 1 << 8;
const long long MAXN2 = 2e7;
const long long MOD = 1e9 + 7;
const long long MO... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
const int maxm = 450000;
const int maxn = 51000;
const int inf = 0x7fffffff / 100;
struct graph {
struct edge {
int v, flow, c, next;
} a[maxm * 4];
int tot, start[maxn], n, m, s, t;
inline void init(int _n) {
n = _n;
memset(start, -1, sizeof(start));
... | ### Prompt
Construct a cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
int MAX(int a, int b) { return (a > b) ? a : b; }
int MIN(int a, int b) { return (a < b) ? a : b; }
int ABS(int x) { return (x > 0) ? x : -x; }
int left(int x) { return (x << 1); }
int right(int x) { return (x << 1) + 1; }
int lsone(int x) { return (x & (-x)); }
int n, t;
s... | ### Prompt
Please formulate a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
const int N = 10 + 2;
const int MX = 900 + 7;
int x, y, n, T;
string s[N], t[N];
int dr[] = {1, -1, 0, 0};
int dc[] = {0, 0, 1, -1};
int dis[N][N], d[N][N];
pair<int, int> q[N * N];
int mat[MX][2];
bool mark[MX];
vector<int> adj[MX];
bool valid(int r, int c) {
return r >=... | ### Prompt
In Cpp, your task is to solve the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300;
const int ROOM = -1;
const int REAC = -2;
const int BAD_REAC = -3;
const int CAPS = ROOM;
class Aresta {
public:
int to, rev, flow, cap;
Aresta() {}
Aresta(int _to, int _rev, int _flow, int _cap) {
to = _to;
rev = _rev;
flow = _flow;... | ### Prompt
Please create a solution in CPP to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
char A[12][12];
char B[12][12];
int n, t;
bool _dp[70][12][12][12][12];
bool dp[12][12][12][12];
int tim[12][12];
void setdp(int tt, int x, int y, int x0, int y0) {
if (t >= 70) return;
if (x < 0 || x >= n || y < 0 || y >= n) return;
if (A[x][y] < '0' || A[x][y] > '9'... | ### Prompt
Generate a CPP solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into 1 ... |
#include <bits/stdc++.h>
using namespace std;
template <class P, class Q>
inline P smin(P &a, Q b) {
if (b < a) a = b;
return a;
}
template <class P, class Q>
inline P smax(P &a, Q b) {
if (a < b) a = b;
return a;
}
const int N = 205, M = N * N;
int read() {
int x;
cin >> x;
return x;
}
int some[M], mark[... | ### Prompt
Please create a solution in Cpp to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
int n, t, bx, by;
char a[15][15], b[15][15];
bool can[65][15][15], vis[65][15][15];
int an, bn;
int al[15][15], ar[15][15], bl[15][15], br[15][15];
bool rea[105][105];
vector<int> v[2005];
void bfs(int x, int y, int cc) {
queue<int> q;
al[x][y] = ++an;
an = ar[x][y] =... | ### Prompt
Your task is to create a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
char s1[15][15], s2[15][15];
int id[15][15], cnt;
int s, t, T, n;
int xz, yz;
int dir[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool inside(int x, int y) {
return x >= 0 && y >= 0 && x < n && y < n && s1[x][y] >= '0' &&
s1[x][y] <= '9';
}
int vv[1000007], nxt[1... | ### Prompt
Your task is to create a cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n d... |
#include <bits/stdc++.h>
using namespace std;
inline 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;
}
const int N = 10005;
co... | ### Prompt
Develop a solution in CPP to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
const int N = 12, W = 65, V = N * N * W + 2 + N * N, E = V * 7 * 2, INF = 1e9;
int n, t, hv[N][N], ex[N][N], lv[V], hed[V], nxt[E], sz = 1, bk[N][N], S, T;
char buf[20];
bool vis[N][N];
std::vector<std::pair<int, int> > q1, q2;
std::queue<int> q;
struct Edge {
int u, v, c, f;
} st[E];
bool bf... | ### Prompt
Please provide a cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long double PI = acosl(-1);
const long long infl = 3e18 + 100;
const int inf = 2e9 + 100;
const int nmax = 2e5 + 5;
const int MAXLG = log2(nmax) + 1;
vector<string> s1, s2;
int g[10][10][10][10];
int n, t;
int dx[4] = {-1, 0, 1, 0};
int dy[4] ... | ### Prompt
Construct a Cpp code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 15, maxt = 65, maxg = 300;
char mapa[maxn][maxn] = {};
char mapb[maxn][maxn] = {};
bool dp[maxt][maxn][maxn][maxn][maxn] = {};
int mapt[maxn][maxn] = {};
int n, T;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int buf[maxg][maxg] = {};
int pre[maxg] =... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
vector<string> start, End;
vector<vector<int> > dead, dist, graph, Rgraph, people, lab;
int n, T, V, s, t;
const int inf = 100000;
vector<int> parent;
bool BFS() {
bool visited[V];
for (int i = 0; i < V; ++i) visited... | ### Prompt
Construct a CPP code solution to the problem outlined:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided in... |
#include <bits/stdc++.h>
using namespace std;
const char infile[] = "input.in";
const char outfile[] = "output.out";
ifstream fin(infile);
ofstream fout(outfile);
const int MAXN = 15;
const int oo = 0x3f3f3f3f;
typedef vector<int> Graph[MAXN * MAXN * 2];
const inline int min(const int &a, const int &b) {
if (a > b) r... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
#include <bits/stdc++.h>
using namespace std;
struct Edge {
int from;
int to;
double length;
Edge(int f, int t, double l) : from(f), to(t), length(l) {}
};
struct Node {
vector<int> out;
};
struct Graph {
vector<Node> nodes;
vector<Edge> edges;
Graph(int nr_nodes, int nr_edges) {
nodes.resize(nr_nod... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 10005;
const int inf = 1 << 30;
struct node {
int u, v, c, next;
} g[MAX * 10];
struct Node {
int x, y, step;
};
int adj[MAX], dis[MAX], cur[MAX], pre[MAX], num[MAX], n, e, s, t, vn, T;
int sx, sy, dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};
int flag[15][15]... | ### Prompt
Please formulate a Cpp solution to the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided... |
#include <bits/stdc++.h>
using namespace std;
struct FlowEdge {
int v, u;
long long int cap, flow = 0;
FlowEdge(int v, int u, long long int cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
const long long int flow_inf = 1e18;
vector<FlowEdge> edges;
vector<vector<int>> adj;
int n, m = 0;
int s, t;
vec... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
int flow[202][202];
int cap[202][202];
int pre[202], que[202], d[202];
int edmondsKarp(int n, int source, int sink) {
int p, q, t, i, j;
while (1) {
memset(pre, -1, sizeof(pre));
d[source] = 0x3f3f3f3f;
p = q = 0, que[q++] = source;
while (p < q && pre[s... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const long long inf = 1e17 + 7;
const long long max_n = 1001;
long long xdir[]{0, 0, -1, 1}, ydir[]{-1, 1, 0, 0};
vector<long long> gr[max_n];
bool used[max_n];
long long pa[max_n];
bool check(lon... | ### Prompt
Please provide a Cpp coded solution to the problem described below:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n ×... |
#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const double eps = 1e-6;
const int fx[4] = {-1, 1, 0, 0};
const int fy[4] = {0, 0, -1, 1};
int n, t, sx, sy, dis[20][20], die[20][20], la[500], ro[500000], pr[500000],
up[500000], now, bl[500], S, T, del, ans, rec[20][20], save[20][20],
... | ### Prompt
Create a solution in cpp for the following problem:
They've screwed something up yet again... In one nuclear reactor of a research station an uncontrolled reaction is in progress and explosion which will destroy the whole station will happen soon.
The station is represented by a square n × n divided into ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.