結果
問題 | No.1162 Many Quotients hard |
ユーザー | こまる |
提出日時 | 2020-11-23 21:22:10 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,780 bytes |
コンパイル時間 | 10,084 ms |
コンパイル使用メモリ | 199,044 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 17:46:30 |
合計ジャッジ時間 | 7,569 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | WA | - |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | WA | - |
testcase_13 | AC | 2 ms
5,376 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | WA | - |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | WA | - |
testcase_39 | AC | 1 ms
5,376 KB |
testcase_40 | AC | 2 ms
5,376 KB |
testcase_41 | AC | 2 ms
5,376 KB |
testcase_42 | AC | 2 ms
5,376 KB |
testcase_43 | AC | 1 ms
5,376 KB |
コンパイルメッセージ
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
ソースコード
LANGUAGEimportControl.MonadimportControl.Monad.ContimportControl.Monad.STimportData.STRef.StrictimportqualifiedData.Vector.Fusion.Stream.MonadicasVFSMimportqualifiedData.Vector.UnboxedasVUimportqualifiedData.Vector.Unboxed.MutableasVUMmain::IO()main = don <- readLn :: IO Intlet vec = quotientRange nprint $ succ $ VU.length $ VU.filter (\(a, _, _) -> a /= 0) vecquotientRange::Int->VUVectorIntIntIntquotientRange n = VU.create $ doret <- VUM.unsafeNew n :: ST s (VUM.STVector s (Int, Int, Int))ptr <- newSTRef (0 :: Int)forG 1 n (^) 2 (+) 1 $ \m -> VUM.unsafeWrite ret m (m, m, n `div` m) >> modifySTRef' ptr succlet m = floor . sqrt . fromIntegral $ nrev1' m $ \i -> doletl = n `div` (i + 1) + 1r = n `div` ip <- readSTRef ptr(_, bb, _) <- VUM.unsafeRead ret (p - 1)when (l <= r && bb < l) $ doVUM.unsafeWrite ret p (l, r, n `div` l)modifySTRef' ptr succreturn retrep::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 . callCCINLINE