結果

問題 No.351 市松スライドパズル
ユーザー momen999momen999
提出日時 2017-04-26 15:02:36
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 2,760 ms
コンパイル使用メモリ 160,052 KB
実行使用メモリ 401,708 KB
最終ジャッジ日時 2023-10-11 13:49:54
合計ジャッジ時間 28,947 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,744 ms
266,340 KB
testcase_01 AC 3 ms
7,044 KB
testcase_02 AC 3 ms
7,088 KB
testcase_03 AC 3 ms
7,060 KB
testcase_04 AC 3 ms
7,116 KB
testcase_05 AC 2 ms
7,184 KB
testcase_06 AC 3 ms
7,196 KB
testcase_07 AC 3 ms
7,180 KB
testcase_08 AC 2 ms
7,100 KB
testcase_09 AC 3 ms
7,236 KB
testcase_10 AC 2 ms
7,172 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Control.Monad

rInt :: String -> Int
rInt = read

rcTuple [rc,x] = (rc, rInt x)

solve _ _ [] r c
    | ((r + c) `mod` 2) == 0    = "white"
    | otherwise                 = "black"
solve w h (rc:rcs) r c = solve w h rcs r' c'
    where
        r'  | (fst rc) == "C" && (snd rc) == c  = (r + h - 1) `mod` h
            | otherwise = r
        c'  | (fst rc) == "R" && (snd rc) == r  = (c + w - 1) `mod` w
            | otherwise = c

main = do
    [w, h] <- map rInt . words <$> getLine
    n <- rInt <$> getLine
    rc <- map (rcTuple . words) <$> replicateM n getLine
    putStrLn $ solve w h rc 0 0
0