#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
//using namespace std;
const int maxn = 1005;
int max(int a, int b){ return a>b ? a:b; }
int min(int a, int b){ return a<b ? a:b; }
int up[maxn][maxn],left[maxn][maxn],right[maxn][maxn],maze[maxn][maxn],n,m;
/*
up[i][j] : the distance from (i,j) to (i-t,j) ,where (i-t,j) is the top free sapce (i,j) can straightly get
there without crossing 'R' space;
Let w......
阅读全文