|
@@ -0,0 +1,44 @@
|
|
1
|
+import numpy as np
|
|
2
|
+
|
|
3
|
+class Plate:
|
|
4
|
+ def __init__(self, h, s, z):
|
|
5
|
+ self.height = []
|
|
6
|
+ self.space = s
|
|
7
|
+ self.zombies = z
|
|
8
|
+
|
|
9
|
+def addToPlates(plates, R, i, x, y):
|
|
10
|
+ print(plates)
|
|
11
|
+ newSpace = [x-R/2, x+R/2, y+R/2, y-R/2]
|
|
12
|
+ newPlate = Plate(1, newSpace, [i])
|
|
13
|
+ toAdd = []
|
|
14
|
+ for p in plates:
|
|
15
|
+ if newSpace[0] <= p.space[1] and newSpace[1] >= p.space[0] and newSpace[2] > p.space[3] and newSpace[3] < p.space[2]:
|
|
16
|
+ # Overlap
|
|
17
|
+ overlapSpace = [max(newSpace[0], p.space[0]), min(newSpace[1], p.space[1]), min(newSpace[2], p.space[2]), max(newSpace[3], p.space[3])]
|
|
18
|
+ print(p.zombies)
|
|
19
|
+ overlapPlate = Plate(newPlate.height + p.height, overlapSpace, p.zombies.extend(newPlate.zombies))
|
|
20
|
+ toAdd.append(overlapPlate)
|
|
21
|
+ plates.append(newPlate)
|
|
22
|
+ plates.extend(toAdd)
|
|
23
|
+
|
|
24
|
+def solve(N, R, XY):
|
|
25
|
+ # print("N={0}, R={1}, XY={2}".format(N, R, XY))
|
|
26
|
+
|
|
27
|
+ # Create plates
|
|
28
|
+ plates = []
|
|
29
|
+ for i, xy in enumerate(XY):
|
|
30
|
+ x, y = xy
|
|
31
|
+ addToPlates(plates, R, i, x, y)
|
|
32
|
+ print(plates)
|
|
33
|
+ return 'white'
|
|
34
|
+
|
|
35
|
+if __name__ == "__main__":
|
|
36
|
+ import fileinput
|
|
37
|
+ f = fileinput.input()
|
|
38
|
+
|
|
39
|
+ T = int(f.readline())
|
|
40
|
+ for case in range(1, T+1):
|
|
41
|
+ N, R = [int(i) for i in f.readline().split()]
|
|
42
|
+ XY = [[int(i) for i in f.readline().split()] for x in range(N)]
|
|
43
|
+ solution = solve(N, R, XY)
|
|
44
|
+ print("Case #{0}: {1}".format(case, solution))
|