結果

問題 No.154 市バス
ユーザー aimyaimy
提出日時 2017-06-16 17:24:53
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 278 bytes
コンパイル時間 2,322 ms
コンパイル使用メモリ 170,624 KB
実行使用メモリ 8,064 KB
最終ジャッジ日時 2024-04-21 10:17:16
合計ジャッジ時間 3,123 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
7,808 KB
testcase_01 AC 108 ms
7,936 KB
testcase_02 AC 108 ms
8,064 KB
testcase_03 AC 85 ms
7,808 KB
testcase_04 AC 104 ms
7,936 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 109 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 Data.Bool

main = getLine >> interact (unlines . map (bool "impossible" "possible" . bus) . lines)

bus m = all (all (>=0)) wgs && last (last wgs) == 0
 where
  wgs = scanl asum [0,0] m
  asum [w,g] 'W' = [w+1, g]
  asum [w,g] 'G' = [w-1, g+1]
  asum [w,g] 'R' = [w, g-1]
0