Skip to content

Instantly share code, notes, and snippets.

@dfyz
Last active December 11, 2015 18:59
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 dfyz/4645824 to your computer and use it in GitHub Desktop.
Save dfyz/4645824 to your computer and use it in GitHub Desktop.
--- 1330_slow.hs 2013-01-27 07:01:28.000000000 +0600
+++ 1330.hs 2013-01-27 07:00:01.000000000 +0600
@@ -1,17 +1,22 @@
import Control.Applicative
import Control.Monad
import Data.Array
+import Data.Maybe
import Data.Time.Clock
import System.IO
import Text.Printf
+import qualified Data.ByteString.Char8 as B
+
+int = fst . fromJust . B.readInt
+
readInt :: IO Int
-readInt = readLn
+readInt = int <$> B.getLine
readIntPair :: IO [Int]
-readIntPair = parseLine <$> getLine
+readIntPair = parseLine <$> B.getLine
where
- parseLine = (map read) . words
+ parseLine = (map int) . B.words
getAnswer prefixSums (from:to:_) = (prefixSums ! to) - (prefixSums ! (from - 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment