結果
問題 | No.153 石の山 |
ユーザー |
|
提出日時 | 2015-02-16 19:49:52 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 6,564 ms |
コンパイル使用メモリ | 174,720 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 14:29:57 |
合計ジャッジ時間 | 7,355 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
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
ソースコード
importControl.ApplicativeimportData.ListimportData.BitsimportData.Arraymex::Int->Intmex list = mex_sub 0 $ sort listwheremex_sub n [] = nmex_sub n (x:xs)| n == x = mex_sub (n+1) xs| otherwise = nnextGrundy::ArrayIntInt->Int->IntnextGrundy gr n = [foldl xor 0 [gr ! (i`div`2) | i<-[n,n+1]]] ++ (if n<3 then [] else [foldl xor 0 [gr ! (i`div`3) | i<-[n..n+2]]])main = dol <- (read::String->Int) <$> getLinelet gr = array (1,l) $ (1,0):[(i,(mex $ nextGrundy gr i))|i<-[2..l]]putStrLn $ if gr!l /= 0 then "A" else "B"