結果
| 問題 |
No.150 "良問"(良問とは言っていない
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-02-15 15:18:41 |
| 言語 | Haskell (9.10.1) |
| 結果 |
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 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | AC * 6 TLE * 1 -- * 13 |
コンパイルメッセージ
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