From 361adb180746237cc00594f3563304e031e398c2 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Mon, 15 Aug 2016 08:59:03 +0800 Subject: [PATCH] Create 100819O.cpp --- Codeforces/Gym/100819O.cpp | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 Codeforces/Gym/100819O.cpp diff --git a/Codeforces/Gym/100819O.cpp b/Codeforces/Gym/100819O.cpp new file mode 100644 index 0000000..690b722 --- /dev/null +++ b/Codeforces/Gym/100819O.cpp @@ -0,0 +1,98 @@ +/// Problem O - Grid +#include +#include +#include + +#include +using namespace std; +#define MAXM 505 +#define MAXN 505 +#define INF 0x3f3f3f3f +#define NINF 0xc0c0c0c0 +int m,n; +char map[MAXM][MAXN]; +int val[MAXM][MAXN]; +struct _pos +{ + int line,col; + _pos(int _line,int _col):line(_line),col(_col){} +}; +void solve() +{ + queue<_pos> bus; + bus.push(_pos(1,1)); + val[1][1]=0; + /// Main Loop + while(!bus.empty()) + { + _pos pos=bus.front(); + bus.pop(); + int power=map[pos.line][pos.col]-'0'; + /// 4 Directions + /// up + if(pos.line-power>0&&val[pos.line][pos.col]+10&&val[pos.line][pos.col]+1