結果
| 問題 |
No.20 砂漠のオアシス
|
| コンテスト | |
| ユーザー |
aimy
|
| 提出日時 | 2017-05-27 16:00:50 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,177 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 149,248 KB |
| 最終ジャッジ日時 | 2024-11-15 04:45:38 |
| 合計ジャッジ時間 | 585 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Main.hs:4:1: error: [GHC-87110]
Could not load module ‘Data.Set’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
4 | import qualified Data.Set as S
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Data.Bool import Data.IntMap.Strict ((!)) import qualified Data.IntMap.Strict as M import qualified Data.Set as S type Vertex = Int type Cost = Int type Heap = S.Set (Cost, Vertex) nullq = S.null empty = S.empty push v c = S.insert (c,v) pop = S.deleteFindMax modulo = 1000 pos x y = modulo*x + y north p = p - modulo south p = p + modulo east p = succ p west p = pred p main = do [n,v,ox,oy] <- map read . words <$> getLine ls <- map read . words <$> getContents putStrLn (bool "NO" "YES" (oasys n v ox oy ls)) oasys n v ox oy ls = M.member pds im1 || ((M.member po im1) && (M.member pds im2)) where (im1,_) = until (nullq . snd) (dp g) (im0,q0) (im2,_) = until (nullq . snd) (dp g) (im0,q1) pdp = pos 1 1 pds = pos n n po = pos oy ox g = M.fromDistinctAscList (zip [pos x y | x<-[1..n], y<-[1..n]] ls) im0 = M.empty q0 = push pdp v empty q1 = push po ((im1!po)*2) empty dp g (im,q) | h < 1 = (im,q') | M.member v im = (im,q') | otherwise = (im',q'') where ((h,v),q') = pop q im' = M.insertWith max v h im q'' = foldr (\w acc -> push w (h-(g!w)) acc) q' vns vns = filter (\w -> M.member w g) (sequence [north,south,east,west] v)
aimy