結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2015-04-16 23:34:49 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 12,537 ms |
コンパイル使用メモリ | 180,048 KB |
実行使用メモリ | 19,968 KB |
最終ジャッジ日時 | 2024-12-26 18:47:14 |
合計ジャッジ時間 | 14,644 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Data.List import Text.Printf import Debug.Trace -- or readInteger readInts :: B.ByteString -> [Int] readInts = map (fst . fromJust . B.readInt) . B.words getInts :: IO [Int] getInts = liftM readInts B.getLine main = do [n] <- getInts xs <- getInts print $ solve $ Data.List.sort xs where solve xs = sub xs 0 2 sub [] _ c = to c sub (x:xs) a c = if x == a then sub xs a (c+1) else to c + sub xs x 1 to c = if c > 1 then 0 else 1