結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-04 11:37:06 |
| 言語 | Haskell (9.10.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 471 bytes |
| コンパイル時間 | 9,286 ms |
| コンパイル使用メモリ | 174,336 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 16:50:43 |
| 合計ジャッジ時間 | 10,133 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 4 WA * 3 |
コンパイルメッセージ
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
ソースコード
main = getLine >>= mapM putStrLn . solve . (\[w, h, c] -> (map read [w, h], c)) . words
solve :: ([Int], String) -> [String]
solve ([w, h], c) = f h where
d = if c == "B" then "W" else "B"
w2 = div w 2
cd = concat $ zipWith (++) (replicate w2 c) (replicate w2 d)
dc = reverse cd
oddL = if odd w then cd ++ c else cd
evenL = if odd w then dc ++ d else dc
f 0 = []
f i | odd i = oddL : f (i - 1)
| otherwise = evenL : f (i - 1)