結果
問題 | No.201 yukicoderじゃんけん |
ユーザー |
|
提出日時 | 2018-01-29 13:42:15 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 632 bytes |
コンパイル時間 | 10,085 ms |
コンパイル使用メモリ | 180,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 18:05:07 |
合計ジャッジ時間 | 11,005 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 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 Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as B main :: IO () main = do solve <$> getl B.words <*> getl B.words >>= B.putStrLn solve :: [ByteString] -> [ByteString] -> ByteString solve [sa, pa, _] [sb, pb, _] | la > lb = sa | la < lb = sb | otherwise = f pa pb where la = B.length pa lb = B.length pb f a b | B.null a = B.pack "-1" | B.head a > B.head b = sa | B.head a < B.head b = sb | otherwise = f (B.tail a) (B.tail b) getl :: (ByteString -> a) -> IO a getl f = f <$> B.getLine