結果
問題 | No.320 眠れない夜に |
ユーザー | Leonardone |
提出日時 | 2015-12-13 03:13:09 |
言語 | Haskell (9.8.2) |
結果 |
MLE
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 1,927 ms |
コンパイル使用メモリ | 160,516 KB |
実行使用メモリ | 820,032 KB |
最終ジャッジ日時 | 2023-10-13 14:15:27 |
合計ジャッジ時間 | 10,230 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
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 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
コンパイルメッセージ
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
ソースコード
-- yukicoder My Practice -- author: Leonardone @ NEETSDKASU import qualified Data.Map as Map main = print . solve . map read . words =<< getLine solve (n:m:_) = Map.findWithDefault (-1) c a where a = g f $ Map.fromList [(0,0)] b = f !! (n - 1) c = b - m f = take n fib g [] m = m g (x:xs) m = g xs $ Map.foldlWithKey h m m where h a k b = Map.insert xk rt a where xk = x + k vl = Map.findWithDefault 0 xk a rt = if vl > 0 then minimum [vl, b + 1] else b + 1 fib = [1, 1] ++ [a + b | x <- [0..], let (a:b:_) = drop x fib]