結果
問題 | No.601 Midpoint Erase |
ユーザー |
![]() |
提出日時 | 2017-12-01 23:17:44 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 159 ms / 2,000 ms |
コード長 | 695 bytes |
コンパイル時間 | 6,500 ms |
コンパイル使用メモリ | 180,308 KB |
実行使用メモリ | 50,816 KB |
最終ジャッジ日時 | 2024-12-23 03:24:14 |
合計ジャッジ時間 | 8,538 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
コンパイルメッセージ
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
ソースコード
{-# 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