結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
aimy
|
| 提出日時 | 2017-05-03 22:34:58 |
| 言語 | Haskell (9.10.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 600 bytes |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 146,568 KB |
| 最終ジャッジ日時 | 2024-11-15 04:45:27 |
| 合計ジャッジ時間 | 1,030 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:1:1: error: [GHC-87110]
Could not load module ‘Data.Map’.
It is a member of the hidden package ‘containers-0.6.8’.
Use -v to see a list of the files searched for.
|
1 | import Data.Map ((!))
| ^^^^^^^^^^^^^^^^^^^^^
Main.hs:2:1: error: [GHC-87110]
Could not load module ‘Data.Map.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 qualified Data.Map.Strict as M
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
import Data.Map ((!)) import qualified Data.Map.Strict as M import Data.List main = do n <- readLn c <- readLn getLine styms <- transpose . map (map read . words) . lines <$> getContents print (shortcut n c styms) shortcut n c = result . foldl' move (M.singleton (1,c) 0) . sort where minimum' xs = if null xs then -1 else minimum xs result im = minimum' $ M.elems $ M.filterWithKey (\(n',_) _ -> n'==n) im move im [s,t,y,m] = M.unionWith min im $ M.filterWithKey (\(_,c') _ -> c'>=0) $ M.mapKeysMonotonic (\(n',c') -> (t,c'-y)) $ M.map (+m) $ M.filterWithKey (\(n',_) _ -> n'==s) im
aimy