09/07/17 22:26:05
>>492
import Control.Monad (foldM)
t492 :: Int -> IO (Int,Int)
t492 n = foldM f (maxBound :: Int,minBound :: Int) [1..n]
where
f (a,b) _ = do
s <- getLine
let n = read s
return (min a n, max b n)
main = getLine >>= t492 . read >>= print