結果
| 問題 |
No.482 あなたの名は
|
| ユーザー |
aimy
|
| 提出日時 | 2017-07-14 13:59:21 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 729 bytes |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 150,016 KB |
| 最終ジャッジ日時 | 2024-11-14 20:06:46 |
| 合計ジャッジ時間 | 1,143 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:2:1: error: [GHC-87110]
Could not load module ‘Data.IntMap.Strict’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
2 | import Data.IntMap.Strict ((!))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:3:1: error: [GHC-87110]
Could not load module ‘Data.IntMap.Strict’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
3 | import qualified Data.IntMap.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import qualified Data.ByteString.Char8 as B import Data.IntMap.Strict ((!)) import qualified Data.IntMap.Strict as M import Data.Maybe import Data.Bool import Data.List main = do [_,k] <- map read . words <$> getLine ds <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine putStrLn $ bool "NO" "YES" (anata k ds) anata :: Integer -> [Int] -> Bool anata k ds = nmin <= k && even (k - nmin) where im = M.fromDistinctAscList (zip [1..] ds) nmin = countCycle 0 im countCycle n im | M.null im = n | otherwise = countCycle (n+n') im'' where ((k,v),im') = M.deleteFindMin im (n',im'') = deleteCycle k v (0, im') deleteCycle k v (n,im) | k == v = (n,im) | otherwise = deleteCycle k (im!v) (n+1, M.delete v im)
aimy