結果
問題 | No.351 市松スライドパズル |
ユーザー | aimy |
提出日時 | 2017-04-18 10:49:32 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 1,564 ms / 2,000 ms |
コード長 | 602 bytes |
コンパイル時間 | 8,380 ms |
コンパイル使用メモリ | 161,592 KB |
実行使用メモリ | 53,232 KB |
最終ジャッジ日時 | 2023-09-26 13:13:09 |
合計ジャッジ時間 | 25,730 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,113 ms
52,428 KB |
testcase_01 | AC | 2 ms
7,072 KB |
testcase_02 | AC | 2 ms
7,028 KB |
testcase_03 | AC | 3 ms
7,100 KB |
testcase_04 | AC | 2 ms
7,104 KB |
testcase_05 | AC | 2 ms
7,164 KB |
testcase_06 | AC | 2 ms
7,244 KB |
testcase_07 | AC | 3 ms
7,332 KB |
testcase_08 | AC | 2 ms
7,024 KB |
testcase_09 | AC | 2 ms
7,176 KB |
testcase_10 | AC | 3 ms
7,268 KB |
testcase_11 | AC | 3 ms
7,660 KB |
testcase_12 | AC | 3 ms
7,484 KB |
testcase_13 | AC | 1,494 ms
52,208 KB |
testcase_14 | AC | 1,534 ms
52,464 KB |
testcase_15 | AC | 1,543 ms
53,196 KB |
testcase_16 | AC | 1,564 ms
53,180 KB |
testcase_17 | AC | 1,513 ms
53,204 KB |
testcase_18 | AC | 1,523 ms
52,456 KB |
testcase_19 | AC | 1,534 ms
53,212 KB |
testcase_20 | AC | 1,544 ms
53,232 KB |
コンパイルメッセージ
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
ソースコード
query :: Int -> Int -> String query h w | odd h == odd w = "white" | otherwise = "black" main = do [h,w] <- map read . words <$> getLine getLine sks <- map ((\[s,k]-> (s, read k)) . words) . lines <$> getContents putStrLn $ (ichimatsu h w sks) ichimatsu :: Int -> Int -> [(String,Int)] -> String ichimatsu h w sks = uncurry query $ foldr (sim h w) (0,0) sks sim :: Int -> Int -> (String,Int) -> (Int,Int) -> (Int,Int) sim h w ("R",k) (h',w') | k/=h' = (h',w') | w'==0 = (h',w-1) | otherwise = (h',w'-1) sim h w ("C",k) (h',w') | k/=w' = (h',w') | h'==0 = (h-1,w') | otherwise = (h'-1,w')