User:Jeff/The Great Wall Game solution

using namespace std; typedef pair p2i; int solve(int, vector &); int bestMatch(int, vector &, vector &); int bestMatch(vector &, int, vector &, vector &, int, int); int dist(p2i&, p2i&); int main { for (int i(1); ; ++i) { int n;    cin >> n;     if (n == 0) return 0; vector stones(n); for (int j(0); j < n; ++j) cin >> stones[j].X >> stones[j].Y;    int ans(solve(n, stones)); if (i > 1) cout << endl; cout << "Board "<<i<<": "<<ans<<" moves required." << endl; } } int solve(int n, vector &stones) { int ans(INF); vector wall(n); for (int i(1); i <= n; ++i) { for (int j(0); j < n; ++j) wall[j] = p2i(i, j+1); ans <?= bestMatch(n, stones, wall); for (int j(0); j < n; ++j) wall[j] = p2i(j+1, i); ans <?= bestMatch(n, stones, wall); }  for (int i(0); i < n; ++i) wall[i] = p2i(i+1, i+1); ans <?= bestMatch(n, stones, wall); for (int i(0); i < n; ++i) wall[i] = p2i(i+1, n-i); ans <?= bestMatch(n, stones, wall); return ans; } int bestMatch(int n, vector &stones, vector &wall) { vector mem((1<?(b.X-a.X)) + ((a.Y-b.Y)>?(b.Y-a.Y)); }
 * 1) include
 * 2) include
 * 1) define X first
 * 2) define Y second
 * 3) define INF (1<<30)