1f20b2f588345646dbf335ff7d6b9995e69f6575f5e16c4733b4fd306cd8536a

Download raw

Created: 2023-12-19 03:40:10.302489 UTC

Size: 455

Preview (limited to 512 bytes)

"module Algo.Leaffix where\n\nimport Data.Vector.Unboxed as V\n\nleaffix :: (Vector Int, Vector Int) -> Vector Int\n{-# NOINLINE leaffix #-}\nleaffix (ls,rs)\n = leaffix (V.replicate (V.length ls) 1) ls rs\n where\n leaffix xs ls rs\n = let zs = V.replicate (V.length ls * 2) 0\n vs = V.update_ zs ls xs\n sums = V.prescanl' (+) 0 vs\n in\n V.zipWith (-) (V.backpermute sums ls) (V.backpermute sums rs)\n\n"


Casa is a service provided by the Haskell Foundation │ Originally developed by FP Complete