結果
問題 | No.3 ビットすごろく |
ユーザー | aimy |
提出日時 | 2017-04-27 16:43:34 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 578 bytes |
コンパイル時間 | 1,956 ms |
コンパイル使用メモリ | 164,848 KB |
実行使用メモリ | 14,704 KB |
最終ジャッジ日時 | 2023-10-11 16:05:25 |
合計ジャッジ時間 | 21,787 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 3 ms
7,564 KB |
testcase_01 | AC | 2 ms
7,696 KB |
testcase_02 | AC | 3 ms
7,660 KB |
testcase_03 | AC | 593 ms
13,012 KB |
testcase_04 | AC | 62 ms
11,960 KB |
testcase_05 | AC | 3,041 ms
13,588 KB |
testcase_06 | AC | 733 ms
13,220 KB |
testcase_07 | AC | 243 ms
12,088 KB |
testcase_08 | AC | 1,772 ms
13,668 KB |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
コンパイルメッセージ
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 Data.List import Data.Tuple import qualified Data.Set as S bitn n = sum $ take w $ unfoldr (return . swap . flip divMod 2) n where w = ceiling (logBase 2 (fromIntegral n)) + 1 main = readLn >>= putStrLn . maybe "-1" show . sugoroku sugoroku n = sugoroku' 1 (S.singleton 1) where sugoroku' s acc | S.member n acc = Just s | next == acc = Nothing | otherwise = sugoroku' (s+1) next where next = S.union adv bak adv = S.filter (\x -> x<=n && x>0) $ S.map (\x -> x + bitn x) acc bak = S.filter (\x -> x<=n && x>0) $ S.map (\x -> x - bitn x) acc