結果

問題 No.380 悪の台本
ユーザー LeonardoneLeonardone
提出日時 2019-09-04 04:49:49
言語 Haskell
(9.8.2)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 945 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 158,880 KB
実行使用メモリ 11,948 KB
最終ジャッジ日時 2023-08-26 20:51:45
合計ジャッジ時間 1,912 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,792 KB
testcase_01 AC 2 ms
6,928 KB
testcase_02 AC 3 ms
6,968 KB
testcase_03 AC 2 ms
6,860 KB
testcase_04 AC 12 ms
11,164 KB
testcase_05 AC 22 ms
11,152 KB
testcase_06 AC 12 ms
11,060 KB
testcase_07 AC 32 ms
10,924 KB
testcase_08 AC 22 ms
11,948 KB
testcase_09 AC 12 ms
11,180 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

--リジャッジで落ちたコードのputStrLnをputStrに変更

-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU
import Data.Char (toLower, isAlphaNum)
import Data.List (inits, isSuffixOf)

main = putStr . solve . lines =<< getContents where

solve x = unlines ans where
    h c | isAlphaNum c = toLower c
        | otherwise    = '.'
    res True  = "CORRECT (maybe)"
    res False = "WRONG!"
    make_suffix s = drop (length s) . inits $ s ++ "..."
    digi_suffix  = make_suffix "nyo"
    petit_suffix = make_suffix "nyu"
    gema_suffix  = make_suffix "gema"
    piyo_suffix  = make_suffix "pyo"
    g s = res . or . map (`isSuffixOf` s)
    f "digi"  s = g s digi_suffix
    f "petit" s = g s petit_suffix
    f "gema"  s = g s gema_suffix
    f "piyo"  s = g s piyo_suffix
    f "rabi"  s = res $ any isAlphaNum s
    f _       _ = res False
    check k = let (n, t) = span (/= ' ') k in f n (map h t)
    ans = map check x
0