JS
Size: a a a
JS
JS
СА
AA
СА
IR
JS
IR
comp hi xs =
sum $ snd $ mapAccumL
(\s (i, x) ->
let
(lts, ges@(Triple il _ _ : _)) =
span (\(Triple _ x' _) -> x' < x) s
in
( Triple i x il : ges
, sum
[ fromIntegral x' * fromIntegral (i' - il') * fromIntegral (i - i')
| Triple i' x' il' <- lts
]
)
)
[Triple 0 hi 0]
(zip [1..] $ xs ++ [hi])
СА
haskell-debug-adapter> <command line>: can't load framework: Cocoa (not found)
СА
к
СА
JS
IR
IR
JS
IR