Skip to content

Commit 0a2b86c

Browse files
committed
fix implementation of KdTree.findNearstPoint
1 parent 81c4038 commit 0a2b86c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AtCoder/Extra/KdTree.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ findNearestPoint KdTree {..} x y
226226
-- it's a leaf
227227
| dataI /= -1 = (dataI, d)
228228
-- look into the children
229-
| d0 < d1 = inner (2 * i + 0) $ inner (2 * i + 1) res
230-
| otherwise = inner (2 * i + 1) $ inner (2 * i + 0) res
229+
| d0 < d1 = inner (2 * i + 1) $ inner (2 * i + 0) res
230+
| otherwise = inner (2 * i + 0) $ inner (2 * i + 1) res
231231
where
232232
d = bestDistSquared i
233233
dataI = dataKt VG.! i
234234
d0 = bestDistSquared (2 * i + 0)
235-
d1 = bestDistSquared (2 * i + 0)
235+
d1 = bestDistSquared (2 * i + 1)

0 commit comments

Comments
 (0)