結果

問題 No.154 市バス
ユーザー tottoripapertottoripaper
提出日時 2015-03-04 17:50:46
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 9,552 ms
コンパイル使用メモリ 174,252 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-21 08:21:19
合計ジャッジ時間 4,972 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
8,192 KB
testcase_01 AC 31 ms
8,064 KB
testcase_02 AC 30 ms
7,936 KB
testcase_03 AC 26 ms
8,064 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 28 ms
7,936 KB
testcase_08 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Control.Monad

main = do
  n <- readLn
  replicateM n $ do
         s <- getLine
         let
             f [] g = g == 0
             f (x:xs) g
               | x == 'W' = f xs g
               | x == 'G' = f xs (g+1)
               | g > 0 = f xs (g-1)
               | otherwise = False
          in putStrLn $ if f s 0 then "possible" else "impossible"
0