Skip to content

Instantly share code, notes, and snippets.

@techno-tanoC
Created January 15, 2015 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techno-tanoC/ff4981ebd84994c38c75 to your computer and use it in GitHub Desktop.
Save techno-tanoC/ff4981ebd84994c38c75 to your computer and use it in GitHub Desktop.
マンガ版「エンジニアでも恋がしたい!」〜転職初日にぶつかった女の子が同僚だった件〜|paizaオンラインハッカソン4 Lite https://paiza.jp/poh/enkoi-ending/fe7cbf79
import Control.Applicative
import Control.Monad
import Data.IntMap
diffRange :: IntMap Int -> Int -> Int -> Int
diffRange xs t d = l - h
where
h = xs ! (d)
l = xs ! (d + t)
main = do
[t, n] <- Prelude.map read . words <$> getLine
ls <- replicateM n readLn
let psum = scanl (+) 0 ls
p = fromList . zip [0..] $ psum
calc = diffRange p t
count = n - t
print $ maximum . fmap calc $ [0..count]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment