結果

問題 No.182 新規性の虜
ユーザー okadukiokaduki
提出日時 2015-04-16 23:34:49
言語 Haskell
(9.8.2)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 4,691 ms
コンパイル使用メモリ 159,860 KB
実行使用メモリ 22,996 KB
最終ジャッジ日時 2023-08-27 07:06:30
合計ジャッジ時間 7,551 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,252 KB
testcase_01 AC 3 ms
7,160 KB
testcase_02 AC 3 ms
7,180 KB
testcase_03 AC 2 ms
7,220 KB
testcase_04 AC 3 ms
7,168 KB
testcase_05 AC 3 ms
7,220 KB
testcase_06 AC 3 ms
7,124 KB
testcase_07 AC 3 ms
7,336 KB
testcase_08 AC 92 ms
18,964 KB
testcase_09 AC 182 ms
22,880 KB
testcase_10 AC 142 ms
19,756 KB
testcase_11 AC 113 ms
18,144 KB
testcase_12 AC 42 ms
14,280 KB
testcase_13 AC 2 ms
7,140 KB
testcase_14 AC 2 ms
7,188 KB
testcase_15 AC 2 ms
7,100 KB
testcase_16 AC 2 ms
7,212 KB
testcase_17 AC 2 ms
7,192 KB
testcase_18 AC 142 ms
20,952 KB
testcase_19 AC 92 ms
17,868 KB
testcase_20 AC 52 ms
15,004 KB
testcase_21 AC 182 ms
22,996 KB
testcase_22 AC 72 ms
16,500 KB
testcase_23 AC 3 ms
7,060 KB
testcase_24 AC 33 ms
19,936 KB
testcase_25 AC 23 ms
15,844 KB
testcase_26 AC 22 ms
12,420 KB
testcase_27 AC 2 ms
7,240 KB
evil01.txt AC 32 ms
17,308 KB
evil02.txt AC 32 ms
17,292 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

ソースコード

diff #

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
0