解题报告
题目传送门
题意:
从n×n的矩阵的左上角走到右下角,每次只能向右和向下走,走到一个格子上加上格子的数,可以走k次。问最大的和是多少。
思路:
建图:每个格子掰成两个点,分别叫“出点”,“入点”,
入点到出点间连一个容量1,费用为格子数的边,以及一个容量∞,费用0的边。
同时,一个格子的“出点”向它右、下的格子的“入点”连边,容量∞,费用0。
源点向(0,0)的入点连一个容...
分类:
其他好文 时间:
2014-08-21 22:56:05
阅读次数:
503
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.思路:参见《浅谈用极大化思想解决最大子矩形问题》。这道题我不会,还...
分类:
其他好文 时间:
2014-08-21 22:45:04
阅读次数:
178
题目链接:http://poj.org/problem?id=3422
题意:有一个n*n的矩阵,格子中的元素是费用,KaKa从左上角开始出发要到达右下角,但是他只能向下走或者向右走,且走过的格子赋值为0,可以走K次,问K次后KaKa能获得的最大费用是多少?
思路:首先解释一下为什么要拆点?
因为要获得最大费用,所以假设当前步选择先下走,最终得到的结果可能不是最大值,但...
分类:
其他好文 时间:
2014-08-21 21:19:35
阅读次数:
254
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2686
和POJ3422一样
删掉K把汇点与源点的容量改为2(因为有两种方向的选择)即可
#include
#include
#include
#include
#include
#include
const int maxn = 20000;
const int maxm = 800...
分类:
其他好文 时间:
2014-08-21 21:18:04
阅读次数:
239
Kaka's Matrix Travels
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 7802
Accepted: 3138
Description
On an N × N chessboard with a non-negative number in ...
分类:
其他好文 时间:
2014-08-21 21:15:18
阅读次数:
300
Matrix
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1665 Accepted Submission(s): 901
Problem Description
Yifenfei very like pla...
分类:
其他好文 时间:
2014-08-21 21:14:04
阅读次数:
326
原题描述: 阿申准备报名参加GT考试,准考证号为N位数 X1X2....Xn(0#include using namespace std;int N,M,K;const int maxm = 30;struct Matrix{ int a[maxm][maxm],n; Matrix(int n,in...
分类:
其他好文 时间:
2014-08-21 21:06:24
阅读次数:
334
(AB)^n=A*(BA)^(n-1)^B
Fast Matrix Calculation
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 576 Accepted Submission(s): 297...
分类:
其他好文 时间:
2014-08-20 22:43:43
阅读次数:
201
Fast Matrix Calculation
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072
K (Java/Others)
Problem Descript...
分类:
其他好文 时间:
2014-08-20 18:03:12
阅读次数:
316