結果
問題 | No.1130 Grid Numbers |
ユーザー | nnsnico |
提出日時 | 2020-08-02 20:40:09 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 851 bytes |
コンパイル時間 | 6,515 ms |
コンパイル使用メモリ | 166,288 KB |
実行使用メモリ | 7,348 KB |
最終ジャッジ日時 | 2023-09-26 13:02:40 |
合計ジャッジ時間 | 7,569 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,192 KB |
testcase_01 | AC | 3 ms
7,248 KB |
testcase_02 | AC | 2 ms
7,212 KB |
testcase_03 | AC | 3 ms
7,168 KB |
testcase_04 | AC | 3 ms
7,164 KB |
testcase_05 | AC | 3 ms
7,220 KB |
testcase_06 | AC | 3 ms
7,164 KB |
testcase_07 | AC | 3 ms
7,172 KB |
testcase_08 | AC | 3 ms
7,176 KB |
testcase_09 | AC | 3 ms
7,220 KB |
testcase_10 | AC | 3 ms
7,348 KB |
testcase_11 | AC | 3 ms
7,260 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
module Main where import qualified Data.ByteString.Char8 as BS import Data.Char import Data.String import Data.List import Data.Maybe import Control.Monad type Width = Int type Height = Int type Rectangle = (Width, Height) type Target = [Int] type OutputValue = [[BS.ByteString]] type InitialValue = OutputValue main :: IO () main = do [h, w] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine xn <- replicateM h $ map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine flatten <- return . sort $ concat xn let r = toOutputValue (w, h) flatten [] mapM_ (putStrLn . BS.unpack . BS.unwords) r toOutputValue :: Rectangle -> Target -> InitialValue -> OutputValue toOutputValue (n, count) ls init | count > 0 = toOutputValue (n, count - 1) (drop n ls) (map (BS.pack . show) (take n ls) : init) | otherwise = reverse init