#include <bits/stdc++.h> using namespace std; const int N = 1 << 16; int res[N]; unordered_set<int> available; int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[8] = {0, 0, 1, -1, 1, -1, -1, 1}; void f(int state) { if (res[state] != -1) return; int flag = 0; for (auto avail : availab...