結果
| 問題 | No.351 市松スライドパズル |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-26 23:55:03 |
| 言語 | Haskell (9.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,136 bytes |
| 記録 | |
| コンパイル時間 | 5,901 ms |
| コンパイル使用メモリ | 196,492 KB |
| 実行使用メモリ | 389,888 KB |
| 最終ジャッジ日時 | 2026-04-04 05:23:55 |
| 合計ジャッジ時間 | 19,603 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 5 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Monad
import Debug.Trace
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
| updateR || updateC = solve w h rcs r' c'
| otherwise = solve w h rcs r c
where
updateR = (fst rc) == "C" && (snd rc) == c
updateC = (fst rc) == "R" && (snd rc) == r
r' | updateR = (r + h - 1) `mod` h
| otherwise = r
c' | updateC = (c + w - 1) `mod` w
| otherwise = c
--r' | updateR = trace ("R : " ++ show r ++ "->" ++ show ((r + h - 1) `mod` h)) ((r + h - 1) `mod` h)
-- | otherwise = trace ("R : " ++ show r) r
--c' | updateC = trace ("C : " ++ show c ++ "->" ++ show ((c + w - 1) `mod` w)) ((c + w - 1) `mod` w)
-- | otherwise = trace ("C : " ++ show c) c
main = do
[w, h] <- map rInt . words <$> getLine
n <- readLn
rc <- map (rcTuple . words) <$> replicateM n getLine
--print $ show w ++ " " ++ show h
--print rc
putStrLn $ solve w h rc 0 0