bool push( const char * k, const char * v ) { V p; strcpy( p.k, k ); strcpy( p.v, v ); params.push_back( p ); }
void dfs(int r, int c, int n) { if (quilt[r][c] != name[n]) return; trail[n++] = Pos(r, c); if (n == nlen) { ++nsol; for (int i = 0; i < nlen; ++i) sol.push_back(trail[i]); return; } for (int i = -1; i <= 1; ++i) for (int j = -1; j <= 1; ++j) { Pos p(r + i, c + j); if (! valid_pos(p)) continue; dfs(p.r, p.c, n); } }
int main() { PV pv; My m(2); pv.push_back(&m); foo(pv); }