結果
問題 | No.62 リベリオン(Extra) |
ユーザー |
|
提出日時 | 2020-10-28 03:17:37 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 13,604 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 154,880 KB |
最終ジャッジ日時 | 2024-11-14 23:53:17 |
合計ジャッジ時間 | 853 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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:27:1: error: [GHC-87110] Could not load module ‘GHC.Integer.GMP.Internals’. It is a member of the hidden package ‘integer-gmp-1.1’. Use -v to see a list of the files searched for. | 27 | import qualified GHC.Integer.GMP.Internals as GMP | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
LANGUAGELANGUAGELANGUAGELANGUAGELANGUAGELANGUAGELANGUAGEimportControl.MonadimportControl.Monad.ContimportControl.Monad.STimportControl.Monad.StateimportData.BitsimportData.BoolimportData.CharimportData.CoerceimportData.IntimportData.MaybeimportData.WordimportGHC.ExtsimportSystem.IOimportUnsafe.CoerceimportqualifiedData.ByteStringasBSimportqualifiedData.ByteString.BuilderasBSBimportqualifiedData.ByteString.CharasBSCimportqualifiedData.ByteString.UnsafeasBSUimportqualifiedGHC.Integer.GMP.InternalsasGMPimportqualifiedData.VectorasVimportqualifiedData.Vector.MutableasVMimportqualifiedData.Vector.Fusion.Stream.MonadicasVFSMimportqualifiedData.Vector.GenericasVGimportqualifiedData.Vector.UnboxedasVUimportqualifiedData.Vector.Unboxed.MutableasVUMmain::IO()main = doquery <- readLn :: IO Intxs <- V.replicateM query $ seqInput 9putBuilder $ v2BLinesWith (bool "Miss" "Hit") $ V.map solver xs_w, _h, _d, _mx, _my, _hx, _hy, _vx, _vy :: Int_w = 0INLINE_h = 1INLINE_d = 2INLINE_mx = 3INLINE_my = 4INLINE_hx = 5INLINE_hy = 6INLINE_vx = 7INLINE_vy = 8INLINEsolver::VUVectorInt->Boolsolver xs = runST $ dolettempVX = xs VU.! _vxtempVY = xs VU.! _vyw = xs VU.! _wh = xs VU.! _h(mx, hx, vx) = if tempVX < 0 then (w - xs VU.! _mx, w - xs VU.! _hx, - tempVX) else (xs VU.! _mx, xs VU.! _hx, tempVX)(my, hy, vy) = if tempVY < 0 then (h - xs VU.! _my, h - xs VU.! _hy, - tempVY) else (xs VU.! _my, xs VU.! _hy, tempVY)if vx == 0then doif mx == hx && ((my > hy && (my - hy) <= (xs VU.! _d) * vy) || (my < hy && (2 * h - my - hy) <= (xs VU.! _d) * vy))then return Trueelse return Falseelse doif vy == 0then doif my == hy && (((mx > hx) && (mx - hx <= (xs VU.! _d) * vx)) || (mx < hx && ((2 * w - mx - hx) <= (xs VU.! _d) * vx)))then return Trueelse return Falseelse doletg = gcd vx vyd = (xs VU.! _d) * gvx' = vx `div` gvy' = vy `div` gys = map fromIntegral [w, h, d, hx, hy, vx', vy']if solver' ys (fi mx) (fi my)|| solver' ys (fi (2 * w - mx)) (fi my)|| solver' ys (fi mx) (fi (2 * h - my))|| solver' ys (fi (2 * w - mx)) (fi (2 * h - my))then return Trueelse return Falsesolver'::Integer->Integer->Integer->Boolsolver' (w:h:d:hx:hy:vx:vy:_) tx ty = runST $ doleta = 2 * w * vyb = -2 * h * vxc = ty * vx - tx * vy + hx * vy - hy * vxg = gcd a (-b)if c `mod` g > 0then return Falseelse doleta' = a `div` gb' = b `div` gc' = c `div` g(_, y) = extgcd b' a'm = c' * y `mod` a'tv = ((ty + 2 * h * m - hy) `div` vy) `mod` (2 * h * a' `div` vy)sv = if tv < 0 then tv + 2 * h * a' `div` vy else tvreturn $ sv <= dstream::Monadm=>Int->Int->VFSMStreammIntstream !l !r = VFSM.Stream step lwherestep x| x < r = return $ VFSM.Yield x (x + 1)| otherwise = return $ VFSM.DoneINLINEINLINErep::Monadm=>Int->Int->m()->m()rep n = flip VFSM.mapM_ (stream 0 n)INLINEwithBreak::r->ContTrIOb->ContTrIOr->IOrwithBreak = flip runContT pure . callCCINLINEinfixl 8 .<<., .>>., .>>>.infixl 6 .^.(.<<.)::Bitsb=>b->Int->b(.<<.) = unsafeShiftLINLINE(.>>.)::Bitsb=>b->Int->b(.>>.) = unsafeShiftRINLINE(.>>>.)::Int->Int->Int(.>>>.) (I# x#) (I# i#) = I# (uncheckedIShiftRL# x# i#)INLINE(.^.) :: Bits b => b -> b -> b(.^.) = xorINLINEclz::FiniteBitsfb=>fb->Intclz = countLeadingZerosINLINEctz::FiniteBitsfb=>fb->Intctz = countTrailingZerosINLINEencode32x2::Int->Int->Intencode32x2 x y = x .<<. 32 .|. yINLINEdecode32x2::Int->IntIntdecode32x2 xy =let !x = xy .>>>. 32!y = xy .&. 0xffffffffin (x, y)INLINEceilPow2::Int->IntceilPow2 n| n > 1 = (-1) .>>>. (clz (n - 1)) + 1| otherwise = 1INLINEfloorPow2::Int->IntfloorPow2 n| n >= 1 = 1 .<<. (63 - (clz n))| otherwise = 0INLINEbitReverse::Int->IntbitReverse= unsafeCoerce. step 32 0xffffffff00000000 0x00000000ffffffff. step 16 0xffff0000ffff0000 0x0000ffff0000ffff. step 08 0xff00ff00ff00ff00 0x00ff00ff00ff00ff. step 04 0xf0f0f0f0f0f0f0f0 0x0f0f0f0f0f0f0f0f. step 02 0xcccccccccccccccc 0x3333333333333333. step 01 0xaaaaaaaaaaaaaaaa 0x5555555555555555. unsafeCoercewherestep::Int->Word64->Word64->Word64->Word64step i ml mr = \ !x -> (x .&. ml) .>>. i .|. (x .&. mr) .<<. iINLINEfi::Int->Integerfi = fromIntegralINLINEfI::Integer->IntfI = fromIntegerINLINEfid::Int->Doublefid = fromIntegralINLINEfif::Int->Floatfif = fromIntegralINLINEpowModInt::Int->Int->Int->IntpowModInt a n mo = fI $ GMP.powModInteger (fi a) (fi n) (fi mo)recipModInt::Int->Int->IntrecipModInt a mo = fI $ GMP.recipModInteger (fi a) (fi mo)extgcd::Integer->Integer->IntegerIntegerextgcd a b = case GMP.gcdExtInteger a b of(# p, q #) -> (p, q)floorSqrt::Int->IntfloorSqrt = floor . sqrt . fromIntegralfloorLog2::Int->IntfloorLog2 x = fromIntegral $ y `unsafeShiftR` 52 - 1023wherey::Word64y = unsafeCoerce (fromIntegral x :: Double)type CParser a = StateT BSC8.ByteString Maybe arunCParser::CParsera->BSC8ByteString->MaybeaBSC8ByteStringrunCParser = runStateTINLINEint::CParserIntint = coerce $ BSC8.readInt . BSC8.dropWhile isSpaceINLINEint1::CParserIntint1 = fmap (subtract 1) intINLINEchar::CParserCharchar = coerce BSC8.unconsINLINEbyte::CParserWord8byte = coerce BS.unconsINLINEskipSpaces::CParser()skipSpaces = modify' (BSC8.dropWhile isSpace)INLINEseqInput::Int->IOVUVectorIntseqInput n = VU.unfoldrN n (runCParser int) <$> BSC8.getLineINLINEparseN1::Int->IOVUVectorIntparseN1 n = VU.unfoldrN n (runCParser int) <$> BSC8.getContentsINLINEparseN2::Int->IOVUVectorIntIntparseN2 n = VU.unfoldrN n (runCParser $ (,) <$> int <*> int) <$> BSC8.getContentsINLINEparseN3::Int->IOVUVectorIntIntIntparseN3 n = VU.unfoldrN n (runCParser $ (,,) <$> int <*> int <*> int) <$> BSC8.getContentsINLINEparseN4::Int->IOVUVectorIntIntIntIntparseN4 n = VU.unfoldrN n (runCParser $ (,,,) <$> int <*> int <*> int <*> int) <$> BSC8.getContentsINLINEparseN5::Int->IOVUVectorIntIntIntIntIntparseN5 n = VU.unfoldrN n (runCParser $ (,,,,) <$> int <*> int <*> int <*> int <*> int) <$> BSC8.getContentsINLINEparseANBN::Int->IOVUVectorIntVUVectorIntparseANBN n = VU.unzip . VU.unfoldrN n (runCParser $ (,) <$> int <*> int) <$> BSC8.getContentsINLINEparseANBNCN::Int->IOVUVectorIntVUVectorIntVUVectorIntparseANBNCN n = VU.unzip3 . VU.unfoldrN n (runCParser $ (,,) <$> int <*> int <*> int) <$> BSC8.getContentsINLINEtype Query3 = (Int, Int, Int)query3Parser::CParserQuery3query3Parser = doskipSpacest <- charcase t of'0' -> (,,) 0 <$> int <*> int_ -> (,,) 1 <$> int <*> pure 0type Query5 = (Int, Int, Int, Int, Int)query5Parser::CParserQuery5query5Parser = doskipSpacest <- charcase t of'0' -> (,,,,) 0 <$> int <*> int <*> int <*> int_ -> (,,,,) 1 <$> int <*> int <*> pure 0 <*> pure 0parseQ5::Int->IOVUVectorQuery5parseQ5 n = VU.unfoldrN n (runCParser query5Parser) <$> BSC8.getContentsINLINEreadInt::BSC8ByteString->IntreadInt = fst . fromJust . BSC8.readIntINLINEgetInt::IOIntgetInt = readInt <$> BSC8.getLineINLINEreadIntList::BSC8ByteString->IntreadIntList = map readInt . BSC8.wordsINLINEgetIntList::IOIntgetIntList = readIntList <$> BS.getLineINLINEreadInteger::BSC8ByteString->IntegerreadInteger = fst . fromJust . BSC8.readIntegerINLINEgetInteger::IOIntegergetInteger = readInteger <$> BSC8.getLineINLINEreadIntegerList::BSC8ByteString->IntegerreadIntegerList = map readInteger . BSC8.wordsINLINEgetIntegerList::IOIntegergetIntegerList = readIntegerList <$> BS.getLineINLINEclassShowAsBuilderawhereshowAsBuilder::a->BSBBuilderdefault showAsBuilder :: (Show a) => a -> BSB.BuildershowAsBuilder = BSB.string8 . showinstanceShowAsBuilderIntwhereshowAsBuilder = BSB.intDecINLINEinstanceShowAsBuilderInt8whereshowAsBuilder = BSB.int8DecINLINEinstanceShowAsBuilderInt16whereshowAsBuilder = BSB.int16DecINLINEinstanceShowAsBuilderInt32whereshowAsBuilder = BSB.int32DecINLINEinstanceShowAsBuilderInt64whereshowAsBuilder = BSB.int64DecINLINEinstanceShowAsBuilderWord8whereshowAsBuilder = BSB.word8DecINLINEinstanceShowAsBuilderWord16whereshowAsBuilder = BSB.word16DecINLINEinstanceShowAsBuilderWord32whereshowAsBuilder = BSB.word32DecINLINEinstanceShowAsBuilderWord64whereshowAsBuilder = BSB.word64DecINLINEinstanceShowAsBuilderIntegerwhereshowAsBuilder = BSB.integerDecINLINEinstanceShowAsBuilderFloatwhereshowAsBuilder = BSB.floatDecINLINEinstanceShowAsBuilderDoublewhereshowAsBuilder = BSB.doubleDecINLINEinstanceShowAsBuilderaVGVectorva=>ShowAsBuildervawhereshowAsBuilder = v2BSpcSepputBuilder::BSBBuilder->IO()putBuilder = BSB.hPutBuilder stdoutINLINEprintVecInLines::VGVectorvaShowAsBuildera=>va->IO()printVecInLines = putBuilder . v2BLinesINLINEprintVecInSpcSepLn::VGVectorvaShowAsBuildera=>va->IO()printVecInSpcSepLn = putBuilder . v2BSpcSepLnINLINEv2BSpcSepLn::VGVectorvaShowAsBuildera=>va->BSBBuilderv2BSpcSepLn = v2BSpcSepLnWith showAsBuilderINLINEv2BSpcSep::VGVectorvaShowAsBuildera=>va->BSBBuilderv2BSpcSep = v2BSpcSepWith showAsBuilderINLINEv2BConcat::VGVectorvaShowAsBuildera=>va->BSBBuilderv2BConcat = v2BConcatWith showAsBuilderINLINEv2BLines::VGVectorvaShowAsBuildera=>va->BSBBuilderv2BLines = v2BLinesWith showAsBuilderINLINEv2BSpcSepLnWith::VGVectorva=>a->BSBBuilder->va->BSBBuilderv2BSpcSepLnWith = v2BSpcSepPostfWith "\n"INLINEv2BSpcSepWith::VGVectorva=>a->BSBBuilder->va->BSBBuilderv2BSpcSepWith = v2BSpcSepPostfWith ""INLINEv2BConcatWith::VGVectorva=>a->BSBBuilder->va->BSBBuilderv2BConcatWith showFct = VG.foldr ((<>) . showFct) memptyINLINEv2BLinesWith::VGVectorva=>a->BSBBuilder->va->BSBBuilderv2BLinesWith showFct = VG.foldr (\a -> (showFct a <>) . (BSB.char7 '\n' <>)) memptyINLINEv2BSpcSepPostf::VGVectorvaShowAsBuildera=>BSByteString->va->BSBBuilderv2BSpcSepPostf = (`v2BSpcSepPostfWith` showAsBuilder)INLINEv2BSpcSepPostfWith::VGVectorva=>BSByteString->a->BSBBuilder->va->BSBBuilderv2BSpcSepPostfWith = vecToBuilder "" " "INLINEvecToBuilder::VGVectorva=>BSByteString->BSByteString->BSByteString->a->BSBBuilder->va->BSBBuildervecToBuilder !prefix !separator !postfix = vecToBuilder_ (BSB.byteString prefix) (BSB.byteString separator) (BSB.byteString postfix)INLINEvecToBuilder_::VGVectorva=>BSBBuilder->BSBBuilder->BSBBuilder->a->BSBBuilder->va->BSBBuildervecToBuilder_ !prefix !separator !postfix showFct vec = prefix <> VG.foldr (\a rest !prefx -> prefx <> (showFct a <> rest separator)) (const postfix)vec memptyINLINE