Codeforces Round #345 (Div. 1) C. Table Compression

原题C. Table Compressiotime limit per tes4 secondmemory limit per tes256 megabyteinpustandard inpuoutpustandard outpuLittle Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired by the new knowledge, Petya is now developing the new compression algorithm which he wants to name dis.Petya decided to compress tables. He is give... Read More

深度优先搜索之栈解迷宫(C++)

在之前的一篇关于搜索的文章中《广度优先搜索算法队解迷宫问题》有提到深度优先搜索(dfs)算法,其中有一种就是本篇文章提到的实现方法:利用栈解迷宫;《广度优先搜索算法队解迷宫问题》中利用栈解迷宫有一个bug,比如:在x点出发,向右走直到尽头回到x点,此时在向其他方向(比如上),那么不能再走曾经向右走过的路(坐标)。这次,我们增加一个direct_mark数组,来标记在每一个坐标上曾经走过的方向。程序范例[code lang="cpp"/** 栈解迷宫 - 深度优先搜索.* @authur genialx <admin@ihuxu.com>*#include <iostr#include <st#define LEFT #define RIGHT #define UP #define DOWN using namespace std;struct Path int x;... Read More