Problem:
Score : 100 points

Problem Statement

Given are three integers A_1, A_2, and A_3.

If A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.

Constraints

1 \leq A_i \leq 13 \ \ (i=1,2,3)

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A_1 A_2 A_3

Output

If A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.

Sample Input 1

5 7 9

Sample Output 1

win

5+7+9=21, so print win.

Sample Input 2

13 7 2

Sample Output 2

bust

13+7+2=22, so print bust.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
using namespace std;
using LL = long long;

const int N = 85;

int n, m;

int a[N][N];

bool dp[N][N][N * N * 2];

inline bool inbound(int i, int j) {
	return i >= 1 && i <= n && j >= 1 && j <= m;
}

int main(int argc, char const *argv[])
{
	// memset(dp, -1, sizeof dp);
	scanf("%d%d", &n, &m);
	for (int i=1; i<=n; ++i)
		for (int j=1; j<=m; ++j) {
			scanf("%d", &a[i][j]);
		}
	for (int i=1; i<=n; ++i)
		for (int j=1; j<=m; ++j) {
			int x; scanf("%d", &x);
			a[i][j] -= x;
			if (a[i][j] < 0) a[i][j] = -a[i][j];
		}

	dp[1][1][a[1][1]] = 1;
	int lim = N * N * 2;
	for (int i=1; i<=n; ++i) {
		for (int j=1; j<=m; ++j) {
			for (int k=0; k<lim; ++k) {
				if (!dp[i][j][k]) continue;
				// printf("%d %d\n", i, j);
				if (inbound(i+1, j)) {
					dp[i+1][j][k+a[i+1][j]] = dp[i+1][j][abs(k-a[i+1][j])] = 1;
				}
				if (inbound(i, j+1)) {
					dp[i][j+1][k+a[i][j+1]] = dp[i][j+1][abs(k-a[i][j+1])] = 1;
				}
			}
		}
	}

	int ans = lim + 1;
	for (int i=0; i<lim; ++i) if (dp[n][m][i]) {ans = i; break;}
    printf("%d\n", ans);
    return 0;
}