結果
問題 | No.1993 Horse Racing |
ユーザー |
![]() |
提出日時 | 2022-07-02 10:40:24 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 4,852 bytes |
コンパイル時間 | 4,261 ms |
コンパイル使用メモリ | 152,704 KB |
最終ジャッジ日時 | 2024-11-27 03:29:55 |
合計ジャッジ時間 | 4,663 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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:13: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. | 13 | import qualified Data.Set as S | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:14: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. | 14 | import qualified Data.Map as Map | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:15:1: error: [GHC-87110] Could not load module ‘Data.Sequence’. It is a member of the hidden package ‘containers-0.6.8’. Use -v to see a list of the files searched for. | 15 | import qualified Data.Sequence as Seq | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:23:1: error: [GHC-87110] Could not load module ‘Data.IntMap’. It is a member of the hidden package ‘containers-0.6.8’. Use -v to see a list of the files searched for. | 23 | import qualified Data.IntMap as IM | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Main.hs:25:1: error: [GHC-87110] Could not load module ‘Control.Monad.Trans.State’. It is a member of the hidden package ‘transformers-0.6.1.0’. Use -v to see a list of the files searched for. | 25 | import qualified Control.Monad.Trans.State as MTS | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
LANGUAGEimportControl.MonadreplicateM,forM_,when,(<=<)importData.MaybefromJustimportData.Array.IOIOUArray,IOArrayimportData.Array.UnboxedUArray,IximportqualifiedData.Array.MArrayasMAimportqualifiedData.Array.IArrayasAimportqualifiedData.ByteString.CharasBSimportqualifiedData.SetasSimportqualifiedData.MapasMapimportqualifiedData.SequenceasSeqimportData.IORefimportControl.Monad.STimportqualifiedData.Vector.UnboxedasVUimportqualifiedData.Vector.Unboxed.MutableasVUMimportqualifiedData.Vector.GenericasVGimportqualifiedData.IntMapasIMimportData.ListsortimportqualifiedControl.Monad.Trans.StateasMTSimportControl.Monad.StateimportqualifiedData.FoldableasF-- ==================================================================main::IO()main = dox <- input @Intas <- input @[Double]print $ solve assolve::Double->Doublesolve as = solve' as 1.0 1000.0wheresolve' [] x dist = dist-dist*xsolve' (a:as) x dist = solve' as (x*(dist-a)/dist)dist-- ==================================================================swapArray::MAMArrayaemIxi=>aie->i->i->m()swapArray a i j = doai <- MA.readArray a iaj <- MA.readArray a jMA.writeArray a i ajMA.writeArray a j aiinitUG::Int->Int->AArrayIntIntinitUG n xs = A.accumArray (flip (:)) [] (0, n-1) $ concatMap (\[a, b] -> [(a, b), (b, a)]) xsseqfront::SeqViewLa->aseqfront(a Seq.:< b) = aseqpop::SeqViewLa->SeqSeqaseqpop(a Seq.:< b) = bmodifyArray::MAMArrayaemIxi=>aie->i->e->e->m()modifyArray !a !i !f = MA.writeArray a i . f =<< MA.readArray a iINLINEtype Bs = BS.ByteStringtype Height = Inttype Width = Inttype MutableArray2D any = IOUArray (Height,Width) anytype Array2D any = UArray (Height, Width) any-- 初期化DP配列====================================================classDPArrayawhereinitDP::Height->Width->a->IOMutableArray2DainstanceDPArrayIntwhereinitDP = ((MA.newArray . ((0, 0) ,)) .) . (. subtract 1) . (,) . subtract 1instanceDPArrayDoublewhereinitDP = ((MA.newArray . ((0, 0) ,)) .) . (. subtract 1) . (,) . subtract 1instanceDPArrayBoolwhereinitDP = ((MA.newArray . ((0, 0) ,)) .) . (. subtract 1) . (,) . subtract 1-- =================================================================-- 入力 =====================================================================================================================================================classReadaInputawhereread'::BSByteString->areadArray2D::Height->Width->BSByteString->ainput::Inputa=>IOainput = read' <$> BS.getLineinputs::Inputa=>IOainputs = read' <$> BS.getContentsinputArray::Inputa=>Int->Int->IOainputArray = flip flip BS.getContents . ((<$>) .) . readArray2DinstanceInputBswhereread' = idinstanceInputIntwhereread' = fst . fromJust . BS.readIntinstanceInputIntegerwhereread' = (read @Integer) . BS.unpackinstanceInputDoublewhereread' = read . BS.unpackinstanceInputBswhereread' = BS.wordsinstanceInputIntwhereread' = map (fst . fromJust . BS.readInt) . BS.wordsinstanceInputDoublewhereread' = map ((read @Double) . BS.unpack) . BS.wordsinstanceInputIntBswhereread' = map ((\[a, b] -> (fst (fromJust (BS.readInt a)), b)) . BS.words) . BS.linesinstanceInputBsIntwhereread' = map ((\[a, b] -> (a, fst (fromJust (BS.readInt b)))) . BS.words) . BS.linesinstanceInputBswhereread' = map BS.words . BS.linesinstanceInputIntwhereread' = map (map (fst . fromJust . BS.readInt) . BS.words) . BS.linesinstanceInputDoublewhereread' = map (map ( (read @Double) . BS.unpack) . BS.words) . BS.linesinstanceInputArray2DIntwherereadArray2D = flip flip ((map (fst . fromJust . BS.readInt) . BS.words) <=< BS.lines) . (((.) . A.listArray . ((0, 0) ,)) .) . (. subtract 1) . (,). subtract 1instanceInputArray2DDoublewherereadArray2D height width = A.listArray ((0, 0), (height - 1, width - 1)) . concatMap (map ((read @Double) . BS.unpack) . BS.words) . BS.linesinstanceInputArray2DCharwherereadArray2D = flip flip (BS.unpack <=< BS.lines) . (((.) . A.listArray . ((0, 0) ,)) .) . (. subtract 1) . (,) . subtract 1-- ============================================================================================================================================================