結果

問題 No.601 Midpoint Erase
ユーザー okadukiokaduki
提出日時 2017-12-01 23:17:44
言語 Haskell
(9.8.2)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 164,916 KB
実行使用メモリ 53,272 KB
最終ジャッジ日時 2023-08-24 18:43:28
合計ジャッジ時間 3,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,112 KB
testcase_01 AC 3 ms
7,196 KB
testcase_02 AC 2 ms
7,120 KB
testcase_03 AC 92 ms
38,160 KB
testcase_04 AC 102 ms
40,208 KB
testcase_05 AC 73 ms
32,984 KB
testcase_06 AC 42 ms
21,248 KB
testcase_07 AC 103 ms
42,104 KB
testcase_08 AC 83 ms
35,668 KB
testcase_09 AC 102 ms
41,176 KB
testcase_10 AC 22 ms
15,512 KB
testcase_11 AC 142 ms
53,272 KB
testcase_12 AC 62 ms
27,684 KB
testcase_13 AC 2 ms
7,148 KB
testcase_14 AC 2 ms
7,084 KB
testcase_15 AC 2 ms
7,144 KB
testcase_16 AC 2 ms
7,144 KB
testcase_17 AC 2 ms
7,076 KB
testcase_18 AC 2 ms
7,340 KB
testcase_19 AC 2 ms
7,224 KB
testcase_20 AC 3 ms
7,240 KB
testcase_21 AC 3 ms
7,164 KB
testcase_22 AC 2 ms
7,208 KB
testcase_23 AC 2 ms
7,096 KB
testcase_24 AC 2 ms
7,124 KB
testcase_25 AC 2 ms
7,144 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 #

{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

count xs a = length $ filter (==a) xs

main = do
  [n] <- getInts
  xs <- map (map (`mod` 2)) <$> replicateM n getInts
  let win = (count xs [0,0] `div` 2) + (count xs [0,1] `div` 2) + (count xs [1,0] `div` 2) + (count xs [1,1] `div` 2)
  putStrLn $ if win `mod` 2 == 0 then "Bob" else "Alice"


-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

substr :: Int -> Int -> B.ByteString -> B.ByteString
substr b l s = B.take l $ B.drop b s
0