結果
問題 | No.714 回転寿司屋のシミュレート |
ユーザー |
|
提出日時 | 2018-07-20 17:57:26 |
言語 | Haskell (9.10.1) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,415 bytes |
コンパイル時間 | 2,095 ms |
コンパイル使用メモリ | 198,936 KB |
最終ジャッジ日時 | 2024-11-14 20:32:45 |
合計ジャッジ時間 | 2,775 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:12:3: error: [GHC-88464] Variable not in scope: replicateM :: Int -> IO [ByteString] -> IO [[ByteString]] Suggested fixes: • Perhaps use one of these: ‘V.replicateM’ (imported from Data.Vector), ‘replicate’ (imported from Prelude), ‘V.replicate’ (imported from Data.Vector) • Add ‘replicateM’ to the import list in the import of ‘Data.Vector’ (at Main.hs:5:1-38). | 12 | replicateM n (B.words <$> B.getLine) >>= solve | ^^^^^^^^^^
ソースコード
importControl.Applicative(<$>)importData.ByteString.CharByteStringimportqualifiedData.ByteString.CharasBimportData.ListdeleteimportData.VectorVector,(!),(//)importqualifiedData.VectorasVimportControl.Monad.Statemain::IO()main = don <- readi B.readInt <$> B.getLinereplicateM n (B.words <$> B.getLine) >>= solvesolve::ByteString->IO()solve bs = evalStateT (sushi bs) (V.replicate 21 [])sushi::ByteString->StateTVectorByteStringIO()sushi [] = return ()sushi ((d:rs):bs) | readi B.readInt d == 0 = dolet (n:_:as) = rsv <- getput $ v // [(readi B.readInt n, as)]sushi bs| readi B.readInt d == 2 = dov <- getput $ v // [(readi B.readInt (head rs), [])]sushi bs| otherwise = dov <- getcase V.findIndex (\ls -> (head rs) `elem` ls) v ofJust x -> dolift $ putStrLn (show x)put $ v // [(x, delete (head rs) (v ! x))]Nothing -> lift $ putStrLn "-1"sushi bsreadi::Integrala=>ByteString->MaybeaByteString->ByteString->areadi f s = let Just (n, _) = f s in n