dfs

UVAOJ10557

Written by  on February 14, 2015

UVAOJ10557 这个题最关键的部分就是对于环的处理。 先记录下每个点是否已经访问,并且到达那个点时候的能量值,然后碰见环再次访问已经访问过的点的时候,如果能量大于之前,就说明通过这个环能量可以增长到无限大,然后再开启另一个DFS探测环是否有到达终点的路线,如果有那么直接就是winnable,否则的话直接放弃这个环。

[Read more...]

UVAOJ705

Written by  on February 13, 2015

UVAOJ705 705 – Slash Maze Time limit: 3.000 seconds   Slash Maze  By filling a rectangle with slashes (/) and backslashes ( ), you can generate nice little mazes. Here is an example:

[Read more...]

POJ1753

Written by  on June 17, 2014

原题POJ1753 Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 36003 Accepted: 15706 Description Flip game is played on a rectangular 4×4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is white and the other one is black and each piece is lying either it’s black or white side up. Each round you flip 3 to 5 pieces, thus changing the color of their upper side from black to white and vice versa. The pieces to be flipped are chosen every round according to the following rules:

[Read more...]