思路:
搜索;
代码:
#include#include #include #include using namespace std;#define maxn 20#define maxm 105#define INF 0x7fffffffint n,m,deep[maxn][2],num[maxn],ans=INF,k,sum[maxn],cnt;char map[maxn][maxm];void dfs(int now,bool st,int val){ if(val>=ans) return; if(now==n) { if(num[now]) { if(st) val+=k-deep[now][0]; else val+=deep[now][1]-1; } if(val