| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
数据非常水,暴力过#include<cstdio>
using namespace std;
const int N=255,INF=1000000007;
int n,m,k;
int G[N][N];
#define max(i,j) (i>j?i:j)
#define min(i,j) (i<j?i:j)
signed main(void){
scanf("%d%d%d",&n,&m,&k);
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
scanf("%d",&G[i][j]);
for(int t=1,x,y,Min,Max;t<=k;t++){
scanf("%d%d",&x,&y);
Min=INF;Max=-INF;
for(int i=x;i<x+m;i++)
for(int j=y;j<y+m;j++)
Min=min(Min,G[i][j]),
Max=max(Max,G[i][j]);
printf("%d\n",Max-Min);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator