output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; const int maxn = 12; const int maxh = 17; const int inf = 10 * 1000; int n; int h[maxn]; int a, b; int d[maxn][maxh][maxh]; pair<int, pair<int, int> > par[maxn][maxh][maxh]; vector<int> ans; void findans(int i, int j, int k) { pair<int, pair<int, int> > pi = par[i][j][k];...
### Prompt Please create a solution in Cpp to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int MXN = 10 + 9; int n, a, b; int h[MXN]; int ansTime = 0x3f3f3f3f; vector<int> ans; vector<int> v; void dfs(int pos, int times) { if (times >= ansTime) return; if (pos == n) { if (times < ansTime) { ansTime = times; ans.clear(); for (unsign...
### Prompt In cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; const int maxN = 10; int a, b, h[maxN], c[maxN], res[maxN], n; void f(int p, int lim) { if (p == n - 1) { for (int i = (1); i <= (n - 2); ++i) if (h[i] >= b * (c[i - 1] + c[i + 1]) + a * c[i]) return; throw 1; } for (int i = 0; i < (lim + 1); ++i) c[p] =...
### Prompt Develop a solution in Cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int h[100005], path[100005]; int sol[100005]; int a, b, n, ans; int k = 0; void decrease(int &x, int &y, int &z) { x -= b; x = max(x, 0); z -= b; z = max(z, 0); y -= a; y = max(y, 0); return; } void dfs(int current, int Left, int mid, int right, int anss) { ...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int n, h[20] = {0}, tmp[20] = {0}, ans[20] = {0}, a, b, MIN = -1; void f(int, int); int main() { int i, j, k; cin >> n >> a >> b; for (i = 0; i < n; i++) cin >> h[i]; f(1, 0); cout << MIN << endl; for (i = 0; i < n; i++) for (j = 0; j < ans[i]; j++) cout << ...
### Prompt Your challenge is to write a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int M = 5e6; const int N = 1e2 + 5; int n, a, b; int h[N]; vector<int> g, v; int ans = 1 << 30; void dfs(int x, int now) { if (now >= ans) return; if (x == n) { if (h[x] < 0) g = v, ans = min(ans, now); return; } for (int i = 0...
### Prompt Construct a Cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; const int M = 20; int h[M]; int n, a, b; int ans = 1e9; int ansn[150], anss[150]; int ceil(int x, int y) { if (x <= 0) return 0; if (x % y) return x / y + 1; return x / y; } void dfs(int p, int pre, int now, int pos, int num) { int t = max(ceil(pre, b), ceil(now, a)...
### Prompt Create a solution in cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; inline int IN() { int x = 0, ch = getchar(), f = 1; while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar(); if (ch == '-') { f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); } return...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int n, x, y; int h[20], p[1000], res[1000]; int ans = 1e9; void attack(int &a, int &b, int &c) { a -= y; if (a < 0) a = 0; b -= x; if (b < 0) b = 0; c -= y; if (c < 0) c = 0; } void go(int cur, int a, int b, int c, int lvl) { if (lvl >= ans) return; if (cur ...
### Prompt Create a solution in CPP for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[110]; vector<int> G, ans; void dfs(int u, bool hehe) { if (u == n && hehe == false) { if (G.size() < ans.size()) ans = G; return; } int siz = 0; if (hehe) { while (h[u - 1] > 0) siz++, h[u - 1] -= b, h[u] -= a, h[u + 1] -= b, G.p...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; const int M = 1e6 + 1; const int base = 1e9 + 7; const double ep = 1e-9; int x[N]; int shot[N]; int n; int res; int a, b; bool DFS(int k, int first, int la) { if (k == 0) { for (int i = 1; i < n + 1; i++) if (x[i] >= 0) return false; r...
### Prompt Create a solution in CPP for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int n, a[100005], res = 1e9, A, B, x[100005], kq[100005], kq1[100005], dem = 0, e[100005]; void no(int val) { if (a[n] >= 0 || a[n - 1] >= 0 || res <= val) return; res = val; for (int i = 2; i <= n - 1; i++) kq[i] = x[i]; return; } void xuli(int i,...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int N = 20, Wf = 150; int n, a, b, h[N], f[N][N][N]; pair<int, int> g[N][N][N]; vector<int> path; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> a >> b; for (int i = (0); i < (n); ++i) { cin >> h[i]; } for (int p = (0)...
### Prompt Create a solution in CPP for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int n, a, b, ans, h[20], buffer[200], res[200]; inline int d(int a, int b) { if (a < 0) return a / b - 1; else return a / b + 1; } void dfs(int x, int times) { if (times >= ans) return; if (x == n) { if (h[n] < 0) { ans = times; memcpy(res, b...
### Prompt Construct a cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int h[20], hit[20], tem[20]; int n, a, b; bool done; void get(int ind, int rem) { if (done) return; if (ind == n - 1) { bool f = 1; for (int i = 1; i < n - 1; i++) { if (h[i] >= tem[i - 1] * b + tem[i + 1] * b + tem[i] * a) { f = 0; break; ...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; struct state { int id, h1, h2, h3; state() {} state(const int &i, const int &j, const int &k, const int &l) { id = i; h1 = j; h2 = k; h3 = l; } bool operator!=(const state &x) const { if (id != x.id) return (true); if (h1 != x.h1) return (t...
### Prompt Develop a solution in CPP to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int cas = 1, T; int n, a, b, h[12], hit[12], ans[12], minhit; void dfs(int x, int sum) { if (x == n) { if (sum <= minhit) { memcpy(ans, hit, sizeof(ans)); minhit = sum; } return; } if (h[x] < 0 && h[x - 1] < 0) { dfs(x + 1, sum); return...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; inline int read() { int X = 0, w = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9') X = (X << 3) + (X << 1) + c - '0', c = getchar(); return X * w; } int h[20]; int a, b; int n; int a...
### Prompt Create a solution in cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> int n, a, b, h[20]; int dp[20][20][20], g[20][20][20]; inline int min(int x, int y) { return x < y ? x : y; } inline int max(int x, int y) { return x > y ? x : y; } int main() { scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; i++) scanf("%d", &h[i]), h[i]++; memset(dp, 0x3f, sizeof(d...
### Prompt Please provide a CPP coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int INF = 0x7f7f7f7f; const double eps = 1e-8; const double PIE = acos(-1.0); const int dx[] = {0, -1, 0, 1}; const int dy[] = {1, 0, -1, 0}; const int fx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; const int fy[] = {-1, 0, 1, -1, 1, -1, 0, 1}; void openfile() { freopen("data....
### Prompt Please create a solution in Cpp to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int INF = 0x7f7f7f7f; const double eps = 1e-8; const double PIE = acos(-1.0); const int dx[] = {0, -1, 0, 1}; const int dy[] = {1, 0, -1, 0}; const int fx[] = {-1, -1, -1, 0, 0, 1, 1, 1}; const int fy[] = {-1, 0, 1, -1, 1, -1, 0, 1}; void openfile() { freopen("data....
### Prompt Please create a solution in Cpp to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int N = 12; const int H = 17; int n, a, b; int h[N]; int d[N][H][H]; int p[N][H][H]; void solve() { scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; i++) scanf("%d", &h[i]); memset(d, 0x7f, sizeof d); for (int i = 0; i < H; i++) if (b * i > h[1]) d[2][...
### Prompt Generate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; const int MAX_N = 100; int cur[MAX_N], d[MAX_N], c[MAX_N], ans[MAX_N]; int a, b, minn = 1e9; vector<int> v; void gen(int k, int n, int sum) { if (k == n) { bool ok = 1; for (int i = (1); (i) < (n + 1); ++i) if (c[i] > 0) ok = 0; if (ok && sum < minn) { ...
### Prompt Generate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; int f[20][20][20], p[20][20][20], q[20][20][20]; int n, a, b, h[20]; void print(int now, int x, int y) { if (now == 2) return; print(now - 1, p[now][x][y], q[now][x][y]); for (int i = 0; i < f[now][x][y] - f[now - 1][p[now][x][y]][q[now][x][y]]; i++) printf...
### Prompt In Cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; int ans = 1e9, h[15], n, a, b; vector<int> T, T2; void dfs(int x, int times) { if (times >= ans) return; if (x == n) { if (h[x] < 0) { T2 = T; ans = times; } return; } for (int i = 0; i <= max(h[x - 1] / b + 1, max(h[x] / a + 1, h[x + ...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-9; const double PI = acos(-1.0); int N, a, b, h[16]; int ret, lg[16], rlg[16]; bool dfs(int id, int sum) { if (sum >= ret) return false; if (id == N - 2) { int lower = (int)ceil((double)(h[N - 1] + 1) / b - EPS); int rhs2 = h[N - 2] + 1, rh...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; template <typename T> double DIS(T va, T vb) { return sqrt((double)(va.x - vb.x) * (va.x - vb.x) + (va.y - vb.y) * (va.y - vb.y)); } template <class T> inline T INT_LEN(T v) { int len = 1; while (v /= 10) ++len; return len; } int h[20], hit[20], flec[2...
### Prompt Please create a solution in cpp to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int toi(string a) { int ans; sscanf(a.c_str(), "%d", &ans); return ans; } string tos(int a) { ostringstream st; st << a; string ans = st.str(); return ans; } int a, b, num[15], n; void g(int &prev, int &current, int &next) { current = max(0, current - a); ...
### Prompt In cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; map<long long, pair<vector<int>, int> > cache; pair<vector<int>, int> solve(long long h, int n, long long a, long long b) { if (cache.count(h) > 0) return cache[h]; if (h == 0) { cache[h] = make_pair(vector<int>(n, 0), 0); return cache[h]; } pair<vector<int>...
### Prompt Develop a solution in Cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int N = 101; const long long MOD = 1e9 + 7; const double eps = 1e-9; int n, a, b, h[N], dp[11][17][17], sol[11][17][17]; int calc(int i, int pre, int cur) { if (i == n - 1) return (pre >= h[i - 1] && cur >= h[i]) ? 0 : 1e9; int &r = dp[i][pre][cur]; if (r != -1)...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int maxN = 100; int a[maxN], A, B, ans[maxN], b[maxN]; int answer = 1000000000, n; vector<int> answerIndex; int get() { int qq = 0; for (int i = 1; i <= n; ++i) b[i] = a[i]; for (int i = 1; i <= n - 2; ++i) { if (b[i] < 0) continue; int cur = b[i] / B + ...
### Prompt Your challenge is to write a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; template <typename T> inline string tostring(T a) { ostringstream os(""); os << a; return os.str(); } template <typename T> inline vector<string> parse(T str) { vector<string> res; string s; istringstream os(str); while (os >> s) res.push_back(s); return res...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; const int maxn = 15; int n, a, b, nowmax; queue<pair<vector<int>, vector<int> > > Q; vector<int> now(15), ansx(15), h(15); set<vector<int> > S; int main() { scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; ++i) scanf("%d", &h[i]); now[0] = (h[1] + 1) / b + ((h[1] ...
### Prompt Please provide a CPP coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int n, a, b, t, arr[11]; int dp[11][17][17]; int dpp[11][17][17]; int solve(int i, int p, int c) { if (i == n - 1) return (p == 0 && c == 0) ? 0 : 1e6; int tmp, pp, cc; int &ret = dp[i][p][c], &j = dpp[i][p][c]; if (ret != -1) return ret; ret = 1e6; j = 1e6; i...
### Prompt In CPP, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; int n, a, b, h[10]; int memo[10][17][17], choose[10][17][17]; int solve(int pos, int last1, int last2) { if (pos == n - 1) { if (b * last2 > h[pos]) return 0; return 200; } int &ret = memo[pos][last1][last2]; if (ret == -1) { ret = 200; for (int i = ...
### Prompt Please provide a CPP coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } int n, a, b, h[15], tot, ans; int p[155], v...
### Prompt Generate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> int n, a, b; int h[20]; int c[20]; int hit[20]; int best[20]; int total_hits; int best_total_hits; int mdiv(int delta, int divisor) { if (delta < 0) { return 0; } if (delta % divisor == 0) { return delta / divisor; } else { return delta / divisor + 1; } } void solve() { ...
### Prompt Please formulate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int maxn = 15; int h[maxn], n, a, b; vector<int> G, ans; void dfs(int ith, bool ok) { if (ith == n && ok == 0) { if (G.size() < ans.size()) ans = G; return; } int size = 0; while (ok && h[ith - 1] >= 0) { h[ith - 1] -= b; h[ith] -= a; h[ith...
### Prompt In cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> #pragma GCC optimize("-O3") using namespace std; const double PI = acos(-1); long long gcd() { return 0ll; } template <typename T, typename... Args> T gcd(T a, Args... args) { return __gcd(a, (__typeof(a))gcd(args...)); } vector<int> ans; int h[17]; int dp[17][17][17], ht[17][17][17], at[17][...
### Prompt Create a solution in Cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; long a, b, n, i, ans, h[20] = {}, f[100] = {}; bool dfs(long d, long x) { if (d == 0) { for (int i = 1; i <= n; i++) if (h[i] >= 0) return false; return true; } if (x == n) { f[d] = n - 1; h[n] -= b; if (dfs(d - 1, x)) return true; h[n] +...
### Prompt Your task is to create a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards an...
#include <bits/stdc++.h> using namespace std; const int maxn = 15 + 2; int n, a, b, h[maxn], ans = 0x7fffffff; vector<int> hit, tmp; void health(int c, int a, int b) { h[c - 1] -= b; h[c + 1] -= b; h[c] -= a; return; } void dfs(int c, int times) { if (times >= ans) return; if (c == n) { if (h[n] < 0) { ...
### Prompt Construct a Cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; long long n, a, b; long long h[20]; long long dp[20][20][20][20]; const long long INF = 1e16; long long solve(long long id, long long hl, long long hc, long long hr) { if (id == n) { if (hc == 0 && hl == 0 && hr == 0) return 0; return INF; } if (dp[id][hl][hc]...
### Prompt In Cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; int dp[20][20][20][20]; int arr[20]; int n, a, b; int func(int totake, int prv, int now, int nxt) { if (totake == n) { if (now > arr[totake] && prv > arr[totake - 1]) return 0; else return (1 << 29); } prv = min(prv, 19); now = min(now, 19); nx...
### Prompt Your challenge is to write a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int h[22], t[22], s[22], out[22]; int i, a, b, n, ans; int count(int s, int a) { int ret = 0; while (s >= 0) s -= a, ++ret; return ret; } void dfs(int l, int sum) { if (sum >= ans) return; int i, tmp; if (l == n) { tmp = max(count(h[n] - s[n], b), count(h[n ...
### Prompt Please formulate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using std::cerr; using std::cin; using std::cout; using std::endl; using std::istream; using std::map; using std::ostream; using std::set; using std::string; using std::vector; ostream &operator<<(ostream &os, const unsigned char v) { os << (int)v; return os; } istream &operator>>(istream &...
### Prompt Develop a solution in CPP to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int dp[12][16][16][16], pre[12][4096]; vector<int> v; int main() { int n, a, b, i, h[12], tp, ans, tq; bool flg = false; scanf("%d%d%d", &n, &a, &b); for (i = 1; i <= n; i++) scanf("%d", &h[i]); ans = tp = h[1] / b + 1; for (i = 0; i < tp; i++) v.push_back(2); ...
### Prompt Create a solution in cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int dp[15][20][20], n, a, b, h[20]; int X[15][20][20], Y[15][20][20]; void output(int dep, int x, int y) { if (dep == 2) return; output(dep - 1, X[dep][x][y], Y[dep][x][y]); for (int i = 0; i < dp[dep][x][y] - dp[dep - 1][X[dep][x][y]][Y[dep][x][y]]; i++) p...
### Prompt Create a solution in Cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; const int N = 10; int n, a, b; int h[N]; map<pair<pair<int, int>, int>, int> dp; map<pair<pair<int, int>, int>, int> pick; int needs(int hp, int damage) { if (hp < 0) return 0; return hp / damage + 1; } int hit(int id, int n, bool hitPrev = false) { for (int i = -1; i...
### Prompt Please provide a CPP coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> const int maxn = 1000; int n, a, b; int h[maxn]; int cur[maxn]; int now[maxn]; int ans = maxn; bool dfs(int who, int num) { int i, j; if (num >= ans) return false; if (who == n) { if (h[n] >= 0) return false; ans = num; for (i = 2; i < n; i++) now[i] = cur[i]; return true;...
### Prompt In CPP, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; int n, a, b, ans = 0x7FFFFFFF, tn = 0; int h[20]; int p[20], pp[20]; bool f[20][100][150][20]; void DFS(int id, int times, int now) { if (f[id][now + 60][tn][times]) return; f[id][now + 60][tn][times] = true; if (id == n) { if (now < 0 && tn <= ans) { ans = ...
### Prompt Generate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; int h[20]; int dp[20][20][20]; int cntL[20][20][20], cntM[20][20][20]; vector<int> v; int main() { int i, j, k, n, a, b, l, m; cin >> n >> a >> b; for (i = 0; i < n; i++) cin >> h[i]; int cnt = 0; while (h[0] >= 0) { h[0] -= b; h[1] -= a; h[2] -= b; ...
### Prompt Your task is to create a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards an...
#include <bits/stdc++.h> using namespace std; struct Node { pair<int, pair<char, char>>* ptr; bool valid; int num; char a, b, f, s; Node() { num = 1000; valid = false; a = b = f = s = 0; ptr = 0; } }; int a, b, N; int h[10]; Node dt[17][17][10]; pair<int, pair<char, char>>* Current; pair<int...
### Prompt Please provide a CPP coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int n, a, b; vector<int> vec, temp, best; void solve(int idx) { if (idx == n) { int c = 0; while (vec[idx] > 0 || vec[idx - 1] > 0) ++c, vec[idx] -= a, vec[idx - 1] -= b, temp.push_back(idx + 1); if ((!best.size()) || best.size() > temp.size()) best = te...
### Prompt Develop a solution in cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[15]; int dp[20][20][20][20], g1[20][20][20][20], g2[20][20][20][20], g3[20][20][20][20]; void hg(int a1, int a2, int a3, int a4) { if (a1 == 0) { return; } for (int i = 0; i < a4; i++) { printf("%d ", a1 + 1); } hg(a1 - 1, g1[a1][a2]...
### Prompt Please formulate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int maxn = 15 + 2; int n, a, b, h[maxn], ans = 0x7fffffff; vector<int> hit, tmp; void health(int c, int a, int b) { h[c - 1] -= b; h[c + 1] -= b; h[c] -= a; return; } void dfs(int c, int times) { if (times >= ans) return; if (c == n) { if (h[n] < 0) { ...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0}; int a[14]; int b[14]; int ans[14]; int x, y; int mi; void f(int u, int e, int step) { int i, tim = 0; if (a[u - 1] >= 0) { tim = (a[u - 1] / y) + 1; } if (u == e) { if (a[e] >= 0) { step += tim + (a[e] / x + ...
### Prompt Develop a solution in CPP to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int ans = 9999999; int h[100]; int a, b, n; vector<int> V; vector<int> V2; void dfs(int x, int times) { if (times >= ans) return; if (x == n) { if (h[x] < 0) { V2 = V; ans = times; } return; } for (int i = 0; i <= max(h[x - 1] / b + 1,...
### Prompt Construct a cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[100]; int dp[12][20][20][20]; int pred1[12][20][20][20]; int pred2[12][20][20][20]; int pred3[12][20][20][20]; int pred4[12][20][20][20]; inline void check(int i, int x, int y, int z, int xx, int yy, int zz, int r) { if (xx) return; if (dp[i][x][y][z]...
### Prompt Develop a solution in Cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> const int maxn = 15; const int maxh = 20; int n, a, b; int h[maxn]; int g[maxn][maxh][maxh]; const int INF = 233; int pre[maxh][maxh][maxh]; int main() { scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; ++i) { scanf("%d", &h[i]); ++h[i]; } for (int i = 1; i <= n; ++i) { ...
### Prompt Your task is to create a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards an...
#include <bits/stdc++.h> using namespace std; int n, x, y, ans; int a[11], b[11]; short int num(int i) { int rlt = 0; while (i) rlt += (i % 9), i /= 9; return rlt; } int main() { scanf("%d %d %d", &n, &x, &y); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); int r1 = a[1] / y + 1, r2 = a[n] / y + 1; if (n...
### Prompt Create a solution in Cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; const int INF = 1e8; int dp[15][20][20], n, a, b; int X[15][20][20], Y[15][20][20]; int h[20], first; void output(int dep, int x, int y) { if (dep == 2) return; output(dep - 1, X[dep][x][y], Y[dep][x][y]); for (int i = 0; i < dp[dep][x][y] - dp[dep - 1][X[dep][x][y]][...
### Prompt Develop a solution in cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int n, a, b, p, e; int h[16]; int s[16 * 16]; int nbs = 0x7fffffff; int bs[16 * 16]; bool is_ans() { for (int i = 1; i <= n; i++) if (h[i] >= 0) { return false; } return true; } void dfs(int i) { if (i >= nbs) { return; } if (is_ans()) { if (...
### Prompt Your challenge is to write a CPP solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> const int N = 18; int h[N]; int f[13][N][N]; std::pair<int, int> opt[13][N][N]; inline void chmin(int &a, const int &b) { (a > b) && (a = b); } void print(int i, int j, int k) { if (i == 1) return; for (int _ = 1; _ <= k; ++_) { printf("%d ", i); } print(i - 1, opt[i][j][k].first, o...
### Prompt Create a solution in Cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFL = 10000000000000000LL; const double eps = 1e-9; const double PI = acos(-1.0); int dp[15][20][20][20]; int v[15]; int n, a, b; struct Node { int i, j, k, l; bool operator==(const Node& tmp) { return i == tmp.i && j == ...
### Prompt Construct a cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int n, a, b; int floord(int x, int y) { if (x < 0) return 0; return (x / y + (x % y ? 1 : 0)); } bool cmpless(std::pair<int, int> p1, std::pair<int, int> p2) { return (p1.first < p2.first || (p1.first == p2.first && (p1.second > p2.second))); } std::vector<i...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int dp[15][20][20], n, a, b, h[20]; int X[15][20][20], Y[15][20][20]; void output(int dep, int x, int y) { if (dep == 2) return; output(dep - 1, X[dep][x][y], Y[dep][x][y]); for (int i = 0; i < dp[dep][x][y] - dp[dep - 1][X[dep][x][y]][Y[dep][x][y]]; i++) p...
### Prompt Your challenge is to write a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int N = 200 + 10; int anum = 1000000000; int cnt; int n; int da; int db; int a[N]; int ans[N]; int fang[N]; void ri() { int i; cin >> n >> da >> db; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < n; i++) a[i]++; } bool ok() { int i; for (i = 0; i < n...
### Prompt Generate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; const int N = 12; const int H = 17; int n, a, b; int h[N]; int d[N][H][H]; int p[N][H][H]; void solve() { scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; i++) scanf("%d", &h[i]); memset(d, 0x7f, sizeof d); for (int i = 0; i < H; i++) if (b * i > h[1]) d[2][...
### Prompt In CPP, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; const int MAXN = 15; int n, a, b; int h[MAXN]; vector<int> ans; vector<int> temp_ans; vector<int> before; void solve(int pos, int prev_health, int next_damage) { if (pos >= n) { if (h[pos] <= next_damage && (temp_ans.size() < ans.size() || ans.size() == 0)) { ...
### Prompt Construct a Cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int h[15], dp[15][20][20], pre1[15][20][20], pre2[15][20][20], n, a, b; void dfs(int nn, int jj, int kk) { if (nn == 1) return; dfs(nn - 1, pre1[nn][jj][kk], pre2[nn][jj][kk]); int tmp = dp[nn][jj][kk] - dp[nn - 1][pre1[nn][jj][kk]][pre2[nn][jj][kk]]; while (tmp--) ...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int maxWord, ns, a, b, mv; int health[20], dp[11][20][20][20][11], mov[200]; int rec(int id, int v1, int v2, int v3, int kill) { if (kill == ns) return dp[id][v1][v2][v3][kill] = 0; if (id >= ns - 1) return 123456; if (dp[id][v1][v2][v3][kill] != -1) return dp[id][v1]...
### Prompt Please formulate a CPP solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int dp[11][17][17][17], h[11]; vector<int> v[11][17][17][17]; struct p { int t, x, y, z; }; int main(void) { int n, a, b; scanf("%d%d%d", &n, &a, &b); for (int i = 1; i <= n; ++i) scanf("%d", &h[i]), h[i]++; memset(dp, 0x3f, sizeof(dp)); dp[2][h[1]][h[2]][h[3]] ...
### Prompt Generate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3 + 100; int n, a, b; int A[maxn], B[maxn]; int ans = 0x3f3f3f3f; vector<int> G, T; void dfs(int pos, int ret) { if (G.size() > ans) return; if (pos == n) { if (A[pos] < 0) { if (ret < ans) { ans = ret; T = G; } } ...
### Prompt Your challenge is to write a CPP solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; int fireball1, fireball2, health[100], attack[100], attack1[100]; int n, sum = 2e+8; void dfs(int x, int y) { if (y >= sum) return; if (x == n) { sum = y; for (int i = 1; i <= n; i++) attack[i] = attack1[i]; return; } for (int i = 0; i <= 100; i++) { ...
### Prompt In cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[11]; int mi[11]; int cop[11]; bool used[11]; vector<int> t; int need(int i) { int q1 = max(max((h[i] + a - 1) / a, (h[i - 1] + b - 1) / b), (h[i + 1] + b - 1) / b); h[i - 1] -= q1 * b; h[i + 1] -= q1 * b; h[i] -= q1 * a; return q1...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996) void nop() { int a = 5; }; int n, a, b, u, ma; int d[20], e[20], f[20]; int st, best, cur; void out() { cout << st + best << endl; for (int i = 2; i < n; i++) for (int j = 0; j < f[i]; j++) cout << i << " "; }; void rec(int p) { if ...
### Prompt Please formulate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int arr[20]; int mem[20][20][20]; int n, a, b; int calc(int ind, int p, int c) { int x0 = arr[ind - 1] - p, x1 = arr[ind] - c, x2 = arr[ind + 1]; int& res = mem[ind][p][c]; if (res != -1) return res; if (ind == n - 2) { res = 0; while (x0 >= 0 || x1 >= 0 || ...
### Prompt Construct a cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; vector<int> q, v; long long n, a, b, m[50], ans = 99999999, aa[50]; void dfs(long long idx, long long sum) { if (sum >= ans) return; if (idx == n) { if (m[n] < 0) { ans = min(ans, sum); v = q; } return; } long long t = max(m[idx - 1] / b, max...
### Prompt Develop a solution in Cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int N = 20; const int INF = 1e6; int n, a, b; int h[N], dp[N][N][N]; pair<int, int> pre[N][N][N]; void output(int id, int x, int y) { if (id == 1) return; int _x = pre[id + 1][x][y].first, _y = pre[id + 1][x][y].second; output(id - 1, _x, _y); for (int i = 0; ...
### Prompt Construct a cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int n, a, b, h[30], f[30][30][30], from[30][30][30]; template <typename T> inline T read() { T x = 0, w = 1; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getc...
### Prompt Please create a solution in Cpp to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e1 + 5, maxm = 15 * 10 + 5; int n, a, b, h[maxn], sum, ans; int pos[maxm], val[maxm]; int rad() { int ret = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '...
### Prompt Your task is to create a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards an...
#include <bits/stdc++.h> using namespace std; long long n, a, b; vector<long long> v(11); long long dp[12][10000][21]; vector<long long> ans; long long f(long long i, long long tak, long long moves) { if (i == n - 1) return 0; if (dp[i][tak][moves] != -1) return dp[i][tak][moves]; long long left = v[i - 1] - tak;...
### Prompt Generate a CPP solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; int n, a, b, h[44], res[44], cnt[44], ans = 1000 * 1000 * 1000; void solve(int pos) { int hcopy[44], ccopy[44]; for (int i = 1; i <= n; i++) hcopy[i] = h[i], ccopy[i] = cnt[i]; if (pos == n - 1) { while (h[pos - 1] >= 0 || h[pos] >= 0 || h[pos + 1] >= 0) h[p...
### Prompt Please formulate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; int n, a, b, f[20] = {0}, SUM = 454345; vector<int> U; vector<int> H; void rec(vector<int> V, int X) { int URT = V.size(); if (URT >= SUM) return; bool T = 0; for (int i = 2; i < n; i++) { if (f[i] >= 0) { T = 1; break; } } if (T == 0) { ...
### Prompt Please formulate a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; pair<long long, long long> dp[12][17][17]; long long n, itself, near, h[12], die1, die2, ans = INF; vector<int> keep[12][17][17], answer; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> itself >> near; for (...
### Prompt Generate a CPP solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; struct ddt { int pos; vector<int> attempts; int sum; ddt(int pos_) { pos = pos_; sum = 0; } }; int main() { int n, A, B; cin >> n >> A >> B; vector<int> a(n); for (auto& i : a) { cin >> i; ++i; } int ans = 1e9; vector<int> res; queu...
### Prompt Your challenge is to write a Cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int inf = 1e8; struct node { int x, y, z, s; } pre[12][18][18][18]; int n, a, b, dp[12][18][18][18], h[12]; vector<int> ans; void f(int i, int x, int y, int z, int v, int xx, int yy, int zz, int s) { x = max(0, x); y = max(0, y); z = max(0, z); if (dp[i][x][...
### Prompt Your task is to create a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards an...
#include <bits/stdc++.h> using namespace std; int h[15], dp[100][100][100], n, a, b, bo[100][100][100]; const int inf = 1e5; int rek(int x, int pr, int cr) { if (x == n) { if (pr < 0 && cr < 0) return 0; return inf; } if (dp[x][pr + 80][cr + 80] != -1) return dp[x][pr + 80][cr + 80]; int nxt = h[x + 1],...
### Prompt Construct a Cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int ans = 9999999; int h[100]; int a, b, n; vector<int> V; vector<int> V2; void dfs(int x, int times) { if (times >= ans) return; if (x == n) { if (h[x] < 0) { V2 = V; ans = times; } return; } for (int i = 0; i <= max(h[x - 1] / b + 1,...
### Prompt In cpp, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; string i2s(long long x) { ostringstream o; o << x; return o.str(); } long long s2i(string s) { istringstream i(s); long long x; i >> x; return x; } int n, b, a; int h[15]; vector<int> res, z; void initialize() { cin >> n >> a >> b; for (int i = 1; i <= n; ...
### Prompt Construct a Cpp code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; } int x[100]; stack<int> st; int n, a, b; int best = 100000; int nums[100], sum[100], best2[100]; bool z; void rec(int k) { if (k > n - 1) { bool z = true; int cnt = 0; for (int i = 2; i <...
### Prompt Create a solution in cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int n, a, b; int num[15]; int fa(int x) { if (x < 0) return 0; return x / a + 1; } int fb(int x) { if (x < 0) return 0; return x / b + 1; } int ans[15], tot; int temp[15]; void dfs(int pos, int cnt) { if (pos == n - 1) { if (num[pos] >= 0) { cnt += fa(nu...
### Prompt In CPP, your task is to solve the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements...
#include <bits/stdc++.h> using namespace std; vector<long long> v, mq; long long n, a, b, sz[15], zx = 999999999; void dfs(long long wz, long long sl) { if (sl >= zx) { return; } if (wz == n) { if (sz[n] < 0) { zx = sl; v = mq; } return; } long long sd = max(sz[wz - 1] / b, max(sz[...
### Prompt Develop a solution in Cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int maxn = 15; int n, a, b; int hs[maxn]; int answerCount = 1000 * 1000; vector<int> answer; vector<int> throwsNow; void gen(int f, int t) { if (f == n - 1) { if (hs[f] <= 0 && t < answerCount) answerCount = t, answer = throwsNow; return; } int cycleFrom...
### Prompt Create a solution in cpp for the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements»...
#include <bits/stdc++.h> using namespace std; int f[20][20][20], q[20][20][20], p[20][20][20], xx[20][20][20], yy[20][20][20]; int h[20]; int tot, x, y, z, h1, h2, h3, n, m, a, b, k, j, tot1; void print(int w, int ii, int jj) { if (w > 0) print(w - 1, xx[w][ii][jj], yy[w][ii][jj]); if (w != m) { for (int i = 1;...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int maxn = 20; const int inf = 1e9; int dp[maxn][maxn][maxn]; int vis[maxn][maxn][maxn]; int path[maxn][maxn][maxn]; int n, a, b; int h[maxn]; int dfs(int i, int cur, int pre) { cur = cur < 0 ? 0 : cur; pre = pre < 0 ? 0 : pre; if (i == n) { if (cur == 0) ...
### Prompt Please provide a Cpp coded solution to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizard...
#include <bits/stdc++.h> using namespace std; const int N = 15, INF = 0x3f3f3f3f; int n, h[N], mx = INF, a, b; vector<int> ans, t; void dfs(int i, int cnt) { if (cnt >= mx) return; if (i == n) { if (h[n] < 0 && cnt < mx) { ans = t; mx = cnt; } return; } int k = max(h[i - 1] / b + 1, max(...
### Prompt Construct a CPP code solution to the problem outlined: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basemen...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[20]; int tans = 100000; vector<int> ans1, ans; void Dfs(int p, int tm) { if (tm >= tans) return; if (p == n) { if (h[n] < 0) { ans = ans1; tans = tm; } return; } for (int i = max(0, h[p - 1] / b); i <= max(h[p - 1] /...
### Prompt Develop a solution in CPP to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double Pi = acos(-1); namespace { template <typename T> inline void read(T &x) { x = 0; T f = 1; char s = getchar(); for (; !isdigit(s); s = getchar()) if (s == '-') f = -1; for (; isdigit(s); s = getchar()) x = (x << 3) + (x ...
### Prompt Generate a cpp solution to the following problem: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Basements». ...
#include <bits/stdc++.h> using namespace std; int n, a, b; int h[15]; int best_fireball = 1e6; int best_ans[15]; int cur_fireball = 0; int cur_ans[15]; void solve(int id) { if (cur_fireball > 100) { return; } if (id == n) { if (h[n - 1] >= 0 || h[n] >= 0) return; if (cur_fireball < best_fireball) { ...
### Prompt Develop a solution in cpp to the problem described below: This is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced. Polycarp likes to play computer role-playing game «Lizards and Base...