Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <cmath>#include <cstdio>#include <cstring>#include <algorithm>#define maxn 51using namespace std;int dp[maxn][maxn][maxn][3][3][3];int ans[maxn][maxn][maxn];int main(){memset(dp, 0x7f, sizeof(dp));memset(ans, 0x7f, sizeof(ans));dp[1][1][0][0][1][0] = 2;dp[1][1][0][1][0][0] = 2;dp[0][1][1][1][2][0] = 2;dp[0][1][1][2][1][0] = 2;dp[1][0][1][0][2][0] = 2;dp[1][0][1][2][0][0] = 2;dp[2][0][0][0][0][0] = 2;dp[0][2][0][1][1][0] = 2;dp[0][0][2][2][2][0] = 2;ans[0][0][0] = 0;ans[1][0][0] = 1;ans[0][1][0] = 1;ans[0][0][1] = 1;for (int i = 0; i < maxn; ++i)