結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー tomcat1233
提出日時 2025-09-06 13:20:09
言語 Haskell
(9.10.1)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,611 bytes
コンパイル時間 8,480 ms
コンパイル使用メモリ 205,804 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2025-09-06 13:20:34
合計ジャッジ時間 7,180 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Control.Monad.ST             
import Data.Ix
import Data.Array (Array)
import Data.Array.IArray
import Data.Array.IO             
import Data.Array.MArray          
import Data.Array.ST                
import Data.Array.Unboxed (UArray)
import Data.Char
import Data.List as L
import Data.Foldable
import Data.Function
import Control.Exception
import Data.Array.Base (STUArray(STUArray), UArray (UArray))
import Data.Array.IO.Internals (IOUArray(IOUArray))
import Data.Ord
import GHC.Float

f m s
  | null s = reverse m
  | h == 'y' = f ("9Yiwiy" ++ m) ds
  | h == '9' = f ("yiwiY9" ++ m) ds
  | otherwise = f (h : m) ts
  where
    (h : ts) = s 
    ds = drop 6 s

main :: IO ()
main = do
  [h, w] <- getIntList
  ss <- replicateM h getLine
  let 
    ans = map (f []) ss
  mapM_ putStrLn ans



--library--------------
modulus :: Int
modulus = 10 ^ 9 + 7
addMod, subMod, mulMod :: Int -> Int -> Int
addMod x y = (x + y) `mod` modulus
subMod x y = (x - y) `mod` modulus
mulMod x y = (x * y) `mod` modulus
tuplify2 :: [b] -> (b, b)
tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
readIntTuple :: BS.ByteString -> (Int, Int)
readIntTuple = tuplify2 . map readInt . BS.words
readIntList :: BS.ByteString -> [Int]
readIntList = map readInt . BS.words

getInt :: IO Int
getInt = readInt <$> BS.getLine
getIntList :: IO [Int]
getIntList = readIntList <$> BS.getLine
0