Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5efb82e

Browse files
committed
Minor changes
1 parent ad5b77b commit 5efb82e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

‎src/lasershot_statues.py‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,28 @@ def number_of_lines_v2(A):
146146
return len(points)
147147

148148

149+
def number_of_lines_v3(A):
150+
points = []
151+
for p1 in A:
152+
ok = False
153+
for p2 in points:
154+
ok = p1.y * p2.x == p2.y * p1.x
155+
if ok:
156+
break
157+
if not ok:
158+
points.append(p1)
159+
return len(points)
160+
161+
149162
def solution_5(A):
150163
count = 0
151164
if not A:
152165
return count
153166
t = ThreadPoolExecutor(4)
154-
f1 = t.submit(number_of_lines_v2, (filter(lambda p: p.x > 0 and p.y > 0, A),))
155-
f2 = t.submit(number_of_lines_v2, (filter(lambda p: p.x < 0 and p.y > 0, A),))
156-
f3 = t.submit(number_of_lines_v2, (filter(lambda p: p.x < 0 and p.y < 0, A),))
157-
f4 = t.submit(number_of_lines_v2, (filter(lambda p: p.x > 0 and p.y < 0, A),))
167+
f1 = t.submit(number_of_lines_v3, (filter(lambda p: p.x > 0 and p.y > 0, A),))
168+
f2 = t.submit(number_of_lines_v3, (filter(lambda p: p.x < 0 and p.y > 0, A),))
169+
f3 = t.submit(number_of_lines_v3, (filter(lambda p: p.x < 0 and p.y < 0, A),))
170+
f4 = t.submit(number_of_lines_v3, (filter(lambda p: p.x > 0 and p.y < 0, A),))
158171
count = f1.result() + f2.result() + f3.result() + f4.result()
159172
return count
160173

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /