結果
問題 | No.2 素因数ゲーム |
ユーザー | myuon |
提出日時 | 2015-03-08 21:16:27 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 816 bytes |
コンパイル時間 | 9,054 ms |
コンパイル使用メモリ | 161,728 KB |
実行使用メモリ | 170,268 KB |
最終ジャッジ日時 | 2023-09-06 22:28:59 |
合計ジャッジ時間 | 21,889 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,140 KB |
testcase_01 | AC | 3 ms
7,344 KB |
testcase_02 | AC | 3 ms
7,240 KB |
testcase_03 | AC | 2 ms
7,236 KB |
testcase_04 | AC | 6 ms
10,560 KB |
testcase_05 | AC | 3 ms
7,848 KB |
testcase_06 | AC | 5 ms
9,664 KB |
testcase_07 | AC | 7 ms
11,268 KB |
testcase_08 | AC | 3,772 ms
170,268 KB |
testcase_09 | AC | 3 ms
7,380 KB |
testcase_10 | AC | 52 ms
14,360 KB |
testcase_11 | AC | 62 ms
14,312 KB |
testcase_12 | AC | 3 ms
7,604 KB |
testcase_13 | AC | 3 ms
8,180 KB |
testcase_14 | AC | 53 ms
14,356 KB |
testcase_15 | AC | 32 ms
13,256 KB |
testcase_16 | AC | 42 ms
13,832 KB |
testcase_17 | AC | 432 ms
32,924 KB |
testcase_18 | AC | 12 ms
11,568 KB |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
コンパイルメッセージ
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 import Numeric import Text.Printf sieve = 2:3:[6*i+j|i<-[1..],j<-[-1,1], isPrime $ 6*i+j] where isPrime n = null [p|p<-takeWhile (\x -> x*x <=n) sieve, rem n p == 0] primeVector n = go n sieve [0] where go 1 _ acc = reverse acc go k (p:ps) (a:acc) | k `mod` p == 0 = go (k `div` p) (p:ps) (a+1:acc) | otherwise = go k ps (0:a:acc) solve n = if solve' n then "Bob" else "Alice" solve' n = check $ fmap go $ primeVector n where go :: Int -> String go x = printf "%010d" $ (read :: String -> Int) $ showIntAtBase 2 (head . show) x "" check ps | all (== "") ps = True | otherwise = ((sum $ fmap (read . return . (!! 0)) ps) `mod` 2 == 0) && check (fmap tail ps) main = do n <- (read :: String -> Int) <$> getLine putStrLn $ solve n