针对一些二维区间最值问题,用一维RMQ来解决显然是不够的.所以,要改进算法.鉴于网上没有PASCAL版的RMQ标程与解析,所以小可在这里简单的讲一下. 核心思想和一维的一样,只是在计算区间时略有不同.用数组F[i,j,k]表示以i,j为左上角的矩形,长度为(1 shl k),然后在循环时取四个矩形的最值,具体伪代码如下: for k:=1 to x do // x为要处理矩形的最大边长的trunc(log2max)值 for i:=1 to n+1-(1 shl k) do for j:=1…
Check Corners Time Limit: 2000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2513 Accepted Submission(s): 904 Problem Description Paul draw a big m*n matrix A last month, whose entries Ai,j are all intege…
Check Corners Time Limit: 2000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2377 Accepted Submission(s): 859 Problem Description Paul draw a big m*n matrix A last month, whose entries Ai,j are all intege…
题目传送门 Cornfields Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7963 Accepted: 3822 Description FJ has decided to grow his own corn hybrid in order to help the cows make the best possible milk. To that end, he's looking to build the c…
Little Tommy is playing a game. The game is played on a 2D N x N grid. There is an integer in each cell of the grid. The rows and columns are numbered from 1 to N. At first the board is shown. When the user presses a key, the screen shows three integ…
Problem Description Paul draw a big m*n matrix A last month, whose entries Ai,j are all integer numbers ( 1 <= i <= m, 1 <= j <= n ). Now he selects some sub-matrices, hoping to find the maximum number. Then he finds that there may be more tha…
Cornfields Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4911 Accepted: 2392 Description FJ has decided to grow his own corn hybrid in order to help the cows make the best possible milk. To that end, he's looking to build the cornfie…