結果

問題 No.547 未知の言語
ユーザー okaduki
提出日時 2017-07-28 22:35:31
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 3,330 ms
コンパイル使用メモリ 180,884 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 02:16:57
合計ジャッジ時間 4,274 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

{-# LANGUAGE FlexibleContexts, OverloadedStrings #-}
import Control.Applicative
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)
import Text.Printf
import Debug.Trace

solve (s:ss) (t:ts) n =
  if s /= t then
    print n >> B.putStrLn s >> B.putStrLn t
  else
    solve ss ts (n+1)

main = do
  [n] <- getInts
  s <- B.words <$> B.getLine
  t <- B.words <$> B.getLine
  solve s t 1

-- util
getInts :: IO [Int]
getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

substr :: Int -> Int -> B.ByteString -> B.ByteString
substr b l s = B.take l $ B.drop b s
0