poj Kaka's Matrix Travels】的更多相关文章

Kaka's Matrix Travels 题目: 给出一个矩阵.求仅仅能向下或者向右的情况下能得到的最大和.一般的是指遍历一次,而这个是能够反复走K次.每经过一次后就把该点设为0.求最大和. 算法: 想到了用网络流做.可是建图没什么自信.看了别人的才敢開始建.建图事实上也不难,就是有一个拆点处理,由于,一个点走一次后其上的值就为0了.这个处理非常巧妙!就是拆点后建立两条边,一条是有价值的边,一条是没价值,可是能够通过的边. 由于,尽管该点没价值,可是有可能其它点要通过它,这就是这题的巧妙之处.…
Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8006   Accepted: 3204 Description On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka mo…
POJ 3422 Kaka's Matrix Travels 链接:http://poj.org/problem? id=3422 题意:有一个N*N的方格,每一个方格里面有一个数字.如今卡卡要从左上角走到右下角,规定每次仅仅能向下或者向右走.每次走到一个格子,将得到该格子的数字,而且该格子的数字变为0.当卡卡走一次时,非常easy求出最大值,问卡卡走k次,可以得到的最大值为多少. 思路:最小费用最大流 关键是怎样构图 1. 将N*N个格点拆分为两个点(i,i + N*N),每一个点之间连一条流…
POJ 3422 Kaka's Matrix Travels 题目链接 题意:一个矩阵.从左上角往右下角走k趟,每次走过数字就变成0,而且获得这个数字,要求走完之后,所获得数字之和最大 思路:有点类似区间k覆盖的建图方法,把点拆了,每一个点有值的仅仅能选一次,其它都是无值的.利用费用流,入点出点之间连一条容量1,有费用的边,和一条容量k - 1,费用0的边,然后其它就每一个点和右边和下边2个点连边.然后跑费用流 代码: #include <cstdio> #include <cstrin…
解题报告 题目传送门 题意: 从n×n的矩阵的左上角走到右下角,每次仅仅能向右和向下走,走到一个格子上加上格子的数,能够走k次.问最大的和是多少. 思路: 建图:每一个格子掰成两个点,分别叫"出点","入点", 入点到出点间连一个容量1.费用为格子数的边.以及一个容量∞,费用0的边. 同一时候.一个格子的"出点"向它右.下的格子的"入点"连边.容量∞,费用0. 源点向(0,0)的入点连一个容量K的边.(N-1,N-1)的出点向…
Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9567   Accepted: 3888 Description On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka mo…
Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6792   Accepted: 2679 Description On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka mo…
Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9522   Accepted: 3875 Description On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka mo…
描述 On an N × N chessboard with a non-negative number in each grid, Kaka starts his matrix travels with SUM = 0. For each travel, Kaka moves one rook from the left-upper grid to the right-bottom one, taking care that the rook moves only to the right o…
                                                        Kaka's Matrix Travels Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9460   Accepted: 3844 Description On an N × N chessboard with a non-negative number in each grid, Kaka starts h…