|
|
|
@ -6,7 +6,9 @@ for l in open("input.txt", 'r').read().splitlines(): |
|
|
|
|
q.append(p[1].split(",")) |
|
|
|
|
lines.append([[int(q[0][0]),int(q[0][1])],[int(q[1][0]), int(q[1][1])]]) |
|
|
|
|
grid = [[0 for i in range(1000)] for j in range(1000)] |
|
|
|
|
gridAll = [[0 for i in range(1000)] for j in range(1000)] |
|
|
|
|
overlaps = 0 |
|
|
|
|
overlapsAll = 0 |
|
|
|
|
|
|
|
|
|
for l in lines: |
|
|
|
|
xDir = 0 |
|
|
|
@ -29,6 +31,11 @@ for l in lines: |
|
|
|
|
grid[i][l[0][1]] += 1 |
|
|
|
|
if grid[i][l[0][1]] == 2: |
|
|
|
|
overlaps += 1 |
|
|
|
|
for i in range(0, max([abs(l[1][0]-l[0][0]),abs(l[1][1]-l[0][1])])+1): |
|
|
|
|
gridAll[l[0][0]+i*xDir][l[0][1]+i*yDir] += 1 |
|
|
|
|
if gridAll[l[0][0]+i*xDir][l[0][1]+i*yDir] == 2: |
|
|
|
|
overlapsAll += 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print(overlaps) |
|
|
|
|
print(overlapsAll) |