-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwalls.py
More file actions
37 lines (26 loc) · 834 Bytes
/
walls.py
File metadata and controls
37 lines (26 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# Southeast USA 2012 6223
# orientation should be 'x' or 'y'
def place_wall(wall_axis, region):
region.sort(key=lambda wall: wall[wall_axis])
bisect_location = len(region) / 2
def check_bisect(wall_axis, wall_loc, region):
before_count = 0
after_count = 0
for location in region:
if location.wall_axis < wall_loc:
before_count += 1
else:
after_count += 1
return abs(after_count - before_count) <= 1
# returns number of walls needed for a region
def place_walls(region):
if len(region) <= 3:
return len(region) - 1
def input_region():
wall_amount = int(input())
regions = [[]]
for i in range(wall_amount):
x, y = tuple(map(int, input().split(' ')))
return region
start_region = input_region()