Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int dp[100][100][2][2];
- bool seen[100][100][2][2];
- int Wins(int a, int b, int c, int d) {
- if (seen[a][b][c][d]) return dp[a][b][c][d];
- if (a == 0 && b == 0) {
- if (c > d) return 1;
- if (c == d) return 0;
- return -1;
- }
- int ans = -1;
- if (a > 0) ans = max(ans, -Wins(a - 1, b, d, !c));
- if (b > 0) ans = max(ans, -Wins(a, b - 1, d, c));
- seen[a][b][c][d] = true;
- return dp[a][b][c][d] = ans;
- }
- int main() {
- for (int a = 0; a <= 20; ++a) {
- for (int b = 0; b <= 20; ++b) {
- if (Wins(a, b, 0, 0) == -1) {
- cout << a << " " << b << endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement