結果
問題 | No.120 傾向と対策:門松列(その1) |
ユーザー | ducktail |
提出日時 | 2018-07-24 15:39:54 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 432 ms / 5,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 12,597 ms |
コンパイル使用メモリ | 163,644 KB |
実行使用メモリ | 60,604 KB |
最終ジャッジ日時 | 2023-09-05 09:51:56 |
合計ジャッジ時間 | 15,573 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 412 ms
60,604 KB |
testcase_01 | AC | 422 ms
59,544 KB |
testcase_02 | AC | 203 ms
35,572 KB |
testcase_03 | AC | 432 ms
59,544 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
ソースコード
import Control.Applicative ((<$>)) import Control.Monad (replicateM) import Data.List (sortBy, group) main :: IO () main = do t <- readLn solve <$> replicateM t (getLine >> map read <$> words <$> getLine) >>= mapM_ print solve :: [[Int]] -> [Int] solve = map (f 0 . map length . group . sort) where f ct xs | length xs < 3 = ct | otherwise = let ss = sort xs (as, bs) = splitAt 3 ss in f (ct+1) ((filter (>0) . map (subtract 1)) as ++ bs) sort :: [Int] -> [Int] sort = sortBy (flip compare)