結果
問題 | No.154 市バス |
ユーザー | ducktail |
提出日時 | 2018-09-13 14:37:32 |
言語 | Haskell (9.8.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 462 bytes |
コンパイル時間 | 1,766 ms |
コンパイル使用メモリ | 167,940 KB |
実行使用メモリ | 57,372 KB |
最終ジャッジ日時 | 2023-09-13 19:52:15 |
合計ジャッジ時間 | 4,307 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 193 ms
57,308 KB |
testcase_01 | AC | 194 ms
57,292 KB |
testcase_02 | AC | 193 ms
57,272 KB |
testcase_03 | AC | 192 ms
57,356 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 3 ms
6,876 KB |
testcase_07 | AC | 193 ms
57,372 KB |
testcase_08 | WA | - |
コンパイルメッセージ
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
ソースコード
import Control.Applicative import Control.Monad import Data.Bool (bool) main :: IO () main = do n <- readLn map solve <$> replicateM n getLine >>= mapM_ putStrLn solve :: String -> String solve bs = bool "impossible" "possible" $ last bs == 'R' && f 0 bs where f g [] = g == 0 f g (b:bs) | b == 'R' = if g > 0 then f (g - 1) bs else False | b == 'G' = f (g + 1) bs | otherwise = f g bs