結果
問題 | No.357 品物の並び替え (Middle) |
ユーザー |
|
提出日時 | 2020-11-05 15:52:45 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,847 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 174,848 KB |
最終ジャッジ日時 | 2024-11-14 23:54:05 |
合計ジャッジ時間 | 870 ms |
ジャッジサーバーID (参考情報) |
judge1 / 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:18:26: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’, imported from ‘Data.Bits’ at Main.hs:4:1-26, or ‘Main..<<.’, defined at Main.hs:60:1. | 18 | dp <- VUM.replicate (1 .<<. n) (0 :: Int) | ^^^^ Main.hs:19:10: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’, imported from ‘Data.Bits’ at Main.hs:4:1-26, or ‘Main..<<.’, defined at Main.hs:60:1. | 19 | rep (1 .<<. n) $ \bit -> rep n $ \v -> do | ^^^^ Main.hs:20:22: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’, imported from ‘Data.Bits’ at Main.hs:4:1-26, or ‘Main..<<.’, defined at Main.hs:60:1. | 20 | when (bit .&. (1 .<<. v) == 0) $ do | ^^^^ Main.hs:23:26: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’, imported from ‘Data.Bits’ at Main.hs:4:1-26, or ‘Main..<<.’, defined at Main.hs:60:1. | 23 | when (bit .&. (1 .<<. i) /= 0) $ do | ^^^^ Main.hs:28:61: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’, imported from ‘Data.Bits’ at Main.hs:4:1-26, or ‘Main..<<.’, defined at Main.hs:60:1. | 28 | VUM.unsafeModify dp (max (item1 + item2)) (bit .|. (1 .<<. v)) | ^^^^ Main.hs:29:35: error: [GHC-87543] Ambiguous occurrence ‘.<<.’. It could refer to either ‘Data.Bits..<<.’,
ソースコード
LANGUAGEimportControl.MonadimportData.BitsimportData.MaybeimportData.IORefimportqualifiedData.ByteString.CharasBSCimportqualifiedData.Vector.Fusion.Stream.MonadicasVFSMimportqualifiedData.Vector.Unboxed.MutableasVUMmain::IO()main = do[n, m] <- map (read :: String -> Int) . words <$> getLinescore <- VUM.replicate (n * n) (0 :: Int)rep m $ \_ -> do[a, b, s] <- getIntListVUM.unsafeWrite score (a * n + b) sdp <- VUM.replicate (1 .<<. n) (0 :: Int)rep (1 .<<. n) $ \bit -> rep n $ \v -> dowhen (bit .&. (1 .<<. v) == 0) $ dosu <- newIORef (0 :: Int)rep n $ \i -> dowhen (bit .&. (1 .<<. i) /= 0) $ doitem <- VUM.unsafeRead score (i * n + v)modifyIORef' su (+ item)item1 <- VUM.unsafeRead dp bititem2 <- readIORef suVUM.unsafeModify dp (max (item1 + item2)) (bit .|. (1 .<<. v))print =<< VUM.unsafeRead dp ((1 .<<. n) - 1)stream::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)INLINEreadInt::BSC8ByteString->IntreadInt = fst . fromJust . BSC8.readIntINLINEgetInt::IOIntgetInt = readInt <$> BSC8.getLineINLINEreadIntList::BSC8ByteString->IntreadIntList = map readInt . BSC8.wordsINLINEgetIntList::IOIntgetIntList = readIntList <$> BSC8.getLineINLINEinfixl 8 .<<.(.<<.)::Bitsb=>b->Int->b(.<<.) = unsafeShiftLINLINE