最大联通子数组,这次的题目,我采用的方法为dfs搜索,按照已经取到的数v[][],来进行搜索过程的状态转移,每次对v[][]中标记为1的所有元素依次取其相邻的未被标记为1的元素,将其标记为1,然而,这样会产生很大的子问题重合,所以必须利用dp来进行记忆化搜索,dp为一集合,集合中的元素为已在前面出现过的v[][]的状态, 然而v[][]为一个二维数组,很不方便存入set,所以使用将v[][]的行经行状态压缩,使用位运算,将行存入 long long 型数中,在按列存入vector中 #inclu…
题目传送门:http://poj.org/problem?id=1579 Function Run Fun Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20560 Accepted: 10325 Description We all love recursion! Don't we? Consider a three-parameter recursive function w(a, b, c): if a <=…
Description Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power is produced. Researchers know the way…
Description In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the morning, after noting which plants hav…
Test for Job Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 11830 Accepted: 2814 Description Mr.Dog was fired by his company. In order to support his family, he must find a new job as soon as possible. Nowadays, It's hard to have a jo…