結果
問題 | No.599 回文かい |
ユーザー |
|
提出日時 | 2020-11-20 17:15:41 |
言語 | Haskell (9.10.1) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 4,918 bytes |
コンパイル時間 | 6,621 ms |
コンパイル使用メモリ | 216,736 KB |
実行使用メモリ | 203,212 KB |
最終ジャッジ日時 | 2024-07-23 12:12:25 |
合計ジャッジ時間 | 10,234 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 7 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
LANGUAGELANGUAGEimportControl.MonadimportControl.Monad.ContimportControl.Monad.STimportControl.Monad.StateimportData.BoolimportqualifiedData.ByteString.CharasBSCimportData.CharimportData.CoerceimportData.IntimportData.MaybeimportqualifiedData.Vector.Fusion.Stream.MonadicasVFSMimportqualifiedData.Vector.UnboxedasVUimportqualifiedData.Vector.Unboxed.MutableasVUMimportUnsafe.Coercemodulus::Intmodulus = 1_000_000_007INLINEmain::IO()main = dolcp <- VUM.unsafeNew (10001 * 10001) :: IO (VUM.IOVector Int16)dp <- VUM.unsafeNew 10000 :: IO (VUM.IOVector Int)s <- VU.fromList <$> getLinerev (VU.length s) $ \i -> rev (VU.length s) $ \j -> doitem <- VUM.unsafeRead lcp ((i + 1) * 10001 + j + 1)VUM.unsafeWrite lcp (i * 10001 + j) (bool 0 (item + 1) (s VU.! i == s VU.! j))VUM.unsafeWrite dp 0 1range 0 (VU.length s `div` 2 - 1) $ \i -> rev' i $ \k -> doitem <- VUM.unsafeRead lcp (k * 10001 + (VU.length s - i - 1))when (unsafeCoerce item >= i - k + 1) $ dodpk <- VUM.unsafeRead dp kVUM.unsafeModify dp (flip mod modulus . (+ dpk)) (i + 1)d <- VU.unsafeFreeze dpprint $ VU.foldl1' (\acc m -> (acc + m) `mod` modulus) $ VU.take (VU.length s) drep::Monadm=>Int->Int->m()->m()rep n = flip VFSM.mapM_ (streamG 0 (n - 1) const 0 (+) 1)INLINErep'::Monadm=>Int->Int->m()->m()rep' n = flip VFSM.mapM_ (streamG 0 n const 0 (+) 1)INLINErep1::Monadm=>Int->Int->m()->m()rep1 n = flip VFSM.mapM_ (streamG 1 (n - 1) const 0 (+) 1)INLINErep1'::Monadm=>Int->Int->m()->m()rep1' n = flip VFSM.mapM_ (streamG 1 n const 0 (+) 1)INLINErev::Monadm=>Int->Int->m()->m()rev n = flip VFSM.mapM_ (streamRG (n - 1) 0 const 0 (-) 1)INLINErev'::Monadm=>Int->Int->m()->m()rev' n = flip VFSM.mapM_ (streamRG n 0 const 0 (-) 1)INLINErev1::Monadm=>Int->Int->m()->m()rev1 n = flip VFSM.mapM_ (streamRG (n - 1) 1 const 0 (-) 1)INLINErev1'::Monadm=>Int->Int->m()->m()rev1' n = flip VFSM.mapM_ (streamRG n 1 const 0 (-) 1)INLINErange::Monadm=>Int->Int->Int->m()->m()range l r = flip VFSM.mapM_ (streamG l r const 0 (+) 1)INLINErangeR::Monadm=>Int->Int->Int->m()->m()rangeR r l = flip VFSM.mapM_ (streamRG r l const 0 (-) 1)INLINEforP::Monadm=>Int->Int->m()->m()forP p = flip VFSM.mapM_ (streamG 2 p (^) 2 (+) 1)INLINEforG::Monadm=>Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->m()->m()forG l r f p g d = flip VFSM.mapM_ (streamG l r f p g d)INLINEforRG::Monadm=>Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->m()->m()forRG r l f p g d = flip VFSM.mapM_ (streamRG r l f p g d)INLINEstreamG::Monadm=>Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->VFSMStreammIntstreamG !l !r !f !p !g !d = VFSM.Stream step lwherestep x| f x p <= r = return $ VFSM.Yield x (g x d)| otherwise = return VFSM.DoneINLINEINLINEstreamRG::Monadm=>Int->Int->Int->Int->Int->Int->Int->Int->Int->Int->VFSMStreammIntstreamRG !r !l !f !p !g !d = VFSM.Stream step rwherestep x| f x p >= l = return $ VFSM.Yield x (g x d)| otherwise = return VFSM.DoneINLINEINLINEwithBreakIO::r->ContTrIOb->ContTrIOr->IOrwithBreakIO = flip runContT pure . callCCINLINEwithBreakST::r->ContTrSTsb->ContTrSTsr->STsrwithBreakST = flip runContT pure . callCCINLINEtype CParser a = StateT BSC8.ByteString Maybe arunCParser::CParsera->BSC8ByteString->MaybeaBSC8ByteStringrunCParser = runStateTINLINEint::CParserIntint = coerce $ BSC8.readInt . BSC8.dropWhile isSpaceINLINEseqInput::Int->IOVUVectorIntseqInput n = VU.unfoldrN n (runCParser int) <$> BSC8.getLineINLINEreadInt::BSC8ByteString->IntreadInt = fst . fromJust . BSC8.readIntINLINEgetInt::IOIntgetInt = readInt <$> BSC8.getLineINLINEreadIntList::BSC8ByteString->IntreadIntList = map readInt . BSC8.wordsINLINEgetIntList::IOIntgetIntList = readIntList <$> BSC8.getLineINLINE