結果
| 問題 |
No.82 市松模様
|
| コンテスト | |
| ユーザー |
dsplit
|
| 提出日時 | 2019-08-14 17:07:37 |
| 言語 | Haskell (9.10.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 505 bytes |
| コンパイル時間 | 3,835 ms |
| コンパイル使用メモリ | 176,340 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-19 14:31:47 |
| 合計ジャッジ時間 | 4,355 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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
ソースコード
import Data.List
import Control.Monad
f :: String -> Char
f "W" = 'B'
f "B" = 'W'
f _ = '@'
g :: String -> Char
g "W" = 'W'
g "B" = 'B'
g _ = '@'
main :: IO ()
main = do
[a, b, c] <- words <$> getLine
let w = (read :: String -> Int) a
h = (read :: String -> Int) b
forM_ [1..h] $ \i -> do
if i `mod` 2 == 1
then putStrLn $ intersperse (f c) $ replicate ((w + 1) `div` 2) (g c)
else putStrLn $ intersperse (g c) $ replicate ((w + 1) `div` 2) (f c)
dsplit