You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import Control.Monad (replicateM, replicateM_) import Data.List (sort, transpose) solve :: (Ord a) => [[a]] -> Bool solve grid = all (\xs -> xs == sort xs) $ transpose $ map sort grid main :: IO () main = do cases <- readLn :: IO Int replicateM_ cases ( do n <- readLn :: IO Int grid <- replicateM n getLine putStrLn $ if solve grid then "YES" else "NO" )
Seems like cookies are disabled on this browser, please enable them to open this website
Grid Challenge
You are viewing a single comment's thread. Return to all comments →
Haskell