Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这……暴力的N^2当然不超时,n才100……好弱的数据

Posted by lydliyudong at 2011-03-28 21:46:17 on Problem 2029
var
 a,sum:array[0..100,0..100]of longint;
 n,w,h,s,t,i,j,x,y,ans:longint;
begin
 repeat
  readln(n);
  if n=0 then break;
  readln(w,h);
  fillchar(a,sizeof(a),0);
  fillchar(sum,sizeof(sum),0);
  for i:=1 to n do
   begin
    readln(x,y);
    a[y,x]:=1;
   end;
  readln(s,t);
  for i:=1 to h do
   for j:=1 to w do
    sum[i,j]:=sum[i-1,j]+sum[i,j-1]-sum[i-1,j-1]+a[i,j];
  ans:=0;
  for i:=t to h do
   for j:=s to w do
    if ans<sum[i,j]-sum[i,j-s]-sum[i-t,j]+sum[i-t,j-s] then
     ans:=sum[i,j]-sum[i,j-s]-sum[i-t,j]+sum[i-t,j-s];
  writeln(ans);
 until false;
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator