Created
March 12, 2011 13:32
-
-
Save ikbear/867238 to your computer and use it in GitHub Desktop.
A solution to this problem B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the problem: | |
# http://www.acm-japan.org/past-icpc/domestic2003/B.htm | |
# Here is the input data: | |
# http://www.acm-japan.org/past-icpc/domestic2003/input/B1.txt | |
import operator,string | |
f = open("B1.txt") | |
while(True): | |
line = int(f.readline()) | |
if 0 == line: | |
break | |
a,b = [],[] | |
w,h = f.readline().split() | |
w,h = string.atoi(w), string.atoi(h) | |
for i in range(line): | |
b.append(f.readline().split()) | |
a.append([string.atoi(b[i][0]), string.atoi(b[i][1])]) | |
a = sorted(a, key=operator.itemgetter(0)) | |
s,t = f.readline().split() | |
s,t = string.atoi(s),string.atoi(t) | |
count = [] | |
for i in range(1, w-s+2): | |
for j in range(1, h-t+2): | |
count.append(0) | |
for k in range(len(a)): | |
if (a[k][0] >= i) & (a[k][0] <= i+s-1): | |
if (a[k][1] >= j) & (a[k][1] <= j+t-1): | |
count[len(count) - 1] += 1 | |
count = sorted(count) | |
print count[len(count)-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment