結果

問題 No.201 yukicoderじゃんけん
ユーザー Michae'GonMichae'Gon
提出日時 2015-07-19 05:09:59
言語 Haskell
(9.8.2)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 687 ms
コンパイル使用メモリ 161,304 KB
実行使用メモリ 11,476 KB
最終ジャッジ日時 2023-09-22 19:11:23
合計ジャッジ時間 1,686 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,796 KB
testcase_01 AC 3 ms
6,856 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 3 ms
7,216 KB
testcase_04 AC 2 ms
7,072 KB
testcase_05 AC 2 ms
7,016 KB
testcase_06 AC 3 ms
6,996 KB
testcase_07 AC 3 ms
6,852 KB
testcase_08 AC 3 ms
7,312 KB
testcase_09 AC 3 ms
7,336 KB
testcase_10 AC 3 ms
7,056 KB
testcase_11 AC 3 ms
7,280 KB
testcase_12 AC 3 ms
7,296 KB
testcase_13 AC 3 ms
7,304 KB
testcase_14 AC 3 ms
6,924 KB
testcase_15 AC 12 ms
11,472 KB
testcase_16 AC 12 ms
11,476 KB
testcase_17 AC 12 ms
11,392 KB
testcase_18 AC 7 ms
11,408 KB
testcase_19 AC 12 ms
11,448 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 #

import Data.Monoid
main = getContents >>= putStrLn . solve . map (\x -> take (length x - 2) x) . lines

solve :: [String] -> String
solve [xs, ys]
    | cond == GT = sa
    | cond == LT = sb
    | otherwise = "-1"
    where
        cond = compare la lb `mappend` comp pa pb
        comp [] [] = mempty
        comp (a : as) (b : bs) = compare a b `mappend` comp as bs
        la = length pa
        lb = length pb
        f = takeWhile (/= ' ')
        g = dropWhile (/= ' ')
        sa = f xs
        sb = f ys
        pa = g xs
        pb = g ys
0