Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int, int>
- #define pb(x) push_back(x)
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvl(vector <ll> &v) {
- for (auto x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvv(vector <vector <int> > &v) {
- for (auto x : v) cv(x);
- cout << "\n";
- }
- void cvb(vector <bool> v) {
- for (bool x : v) cout << x << ' ';
- cout << "\n";
- }
- void cvs(vector <string> v) {
- for (auto a : v) {
- cout << a << "\n";
- }
- }
- void cvp(vector <pii> a) {
- for (auto p : a) {
- cout << p.first << ' ' << p.second << "\n";
- }
- cout << "\n";
- }
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- vector <vector <int> > dp(80, vector <int> (80, 100));
- bool sh = 0;
- for (int j = 77; j >= 36; --j) {
- for (int i = 7; i <= 77; ++i) {
- dp[i][j] = 1;
- }
- }
- for (int j = 35; j >= 0; --j) {
- for (int i = 76; i >= 7; --i) {
- if (sh) {
- cout << "(" << i << "," << j << ")\n";
- }
- if (min(i, j) + max(i, j) * 2 >= 77) {
- dp[i][j] = 1;
- if (sh) {
- cout << "ok\n";
- cout << "\n\n";
- }
- continue;
- }
- vector <pii> to = { {i + 1, j}, {i, j + 1}, {i, j * 2}, {i*2, j} };
- int in_win = 100, in_lose = 0;
- if (sh) {
- cout << "to\n";
- cvp(to);
- }
- for (pii p: to) {
- int x = p.first, y = p.second;
- if (sh) {
- cout << "x y = " << x << ' ' << y << "\n";
- cout << "dp[x][y] = " << dp[x][y] << "\n";
- }
- if (dp[x][y] < 0) {
- in_win = min(in_win, -dp[x][y] + 1);
- }
- if (dp[x][y] >= 1) {
- in_lose = -max(abs(in_lose), dp[x][y]);
- }
- }
- if (in_win == 100) {
- dp[i][j] = in_lose;
- } else {
- dp[i][j] = in_win;
- }
- if (sh) {
- cout << "in_win = " << in_win << "\n";
- cout << "in_lose = " << in_lose << "\n";
- }
- if (sh) {
- cout << "\n\n";
- }
- }
- }
- for (int i = 7; i <= 40; ++i) {
- for (int j = 30; j <= 35; ++j) {
- cout << dp[i][j] << ' ';
- } cout << "\n";
- }
- for (int j = 0; j < 77; ++j) {
- if (dp[7][j] == -2) {
- cout << j << ' ' ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement