結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
|
提出日時 | 2015-02-15 15:18:41 |
言語 | Haskell (9.8.2) |
結果 |
TLE
(最新)
OLE
(最初)
|
実行時間 | - |
コード長 | 734 bytes |
コンパイル時間 | 8,151 ms |
コンパイル使用メモリ | 168,192 KB |
実行使用メモリ | 20,992 KB |
最終ジャッジ日時 | 2024-06-23 20:21:48 |
合計ジャッジ時間 | 19,762 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,619 ms
20,992 KB |
testcase_01 | AC | 3 ms
6,816 KB |
testcase_02 | AC | 7 ms
7,808 KB |
testcase_03 | AC | 9 ms
8,192 KB |
testcase_04 | AC | 8 ms
7,936 KB |
testcase_05 | AC | 144 ms
9,216 KB |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
コンパイルメッセージ
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
ソースコード
import Control.Applicative import Control.Monad import Data.List import Data.Maybe import Debug.Trace calc :: String -> Int calc s = minimum $ map fst $ concatMap (\ (dis,str) -> mapMaybe (diffstr "problem" dis) $ tails str ) $ mapMaybe (diffstr "good" 0) $ tails s where diffstr :: String -> Int -> String -> Maybe (Int,String) diffstr "" distance srcstr = Just (distance,srcstr) diffstr _ _ "" = Nothing diffstr targetstr@(x:xs) distance srcstr@(y:ys) | x == y = trace (show (1,targetstr,distance,srcstr)) $ diffstr xs distance ys | otherwise = trace (show (2,targetstr,distance,srcstr)) $ diffstr xs (distance+1) ys main = do _:sl <- lines <$> getContents mapM_ (print . calc) sl