Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
module Main where
import Control.Monad
import Data.List
type Line = [Int]
data Wire = Wire { start :: Int
, end :: Int } deriving Show
type TestCase = [Wire]
main = do
cases <- parseCases
let solns = map countCrossings cases
mapM_ printSoln $ zip [1..] solns
frame :: IO a -> IO [a]
frame p = do
count <- getLine
replicateM (read count) p
parseCases :: IO [TestCase]
parseCases = frame parseCase
parseCase :: IO TestCase
parseCase = frame getLine >>= return . linesToWires
linesToWires :: [String] -> [Wire]
linesToWires = map (\[s,e] -> Wire s e) . (map . map) read . map words
printSoln :: (Int, Int) -> IO ()
printSoln (n, count) = putStrLn $ "Case #" ++ show n ++ ": " ++ show count
countCrossings :: TestCase -> Int
countCrossings = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.