cornfields专题

POJ 2019 Cornfields 二维RMQ

题目来源:POJ 2019 Cornfields 题意:求正方形二维区间最大最小值的差 思路:直接二维ST搞 试模版而已 #include <cstdio>#include <algorithm>#include <cmath>using namespace std;const int maxn = 255;int dp[maxn][maxn][8][8];int dp

POJ 2019 Cornfields (二维RMQ)

http://poj.org/problem?id=2019 题意:给定一个 N∗N N ∗ N N*N的矩阵和一个整数 B (1<=B<=N) B ( 1 <= B <= N ) B\ (1 <= B <= N), K K K次询问,每次询问给出一个位置x,yx,yx,y,求以 x,y x , y x,y为左上角的 B∗B B ∗ B B*B的子矩阵中的最大差值(最大值减最小值)是多