結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー | ducktail |
提出日時 | 2018-09-16 17:26:14 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 28 ms / 1,000 ms |
コード長 | 1,064 bytes |
コンパイル時間 | 5,343 ms |
コンパイル使用メモリ | 175,684 KB |
実行使用メモリ | 7,936 KB |
最終ジャッジ日時 | 2024-09-14 12:45:03 |
合計ジャッジ時間 | 6,662 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
7,808 KB |
testcase_01 | AC | 28 ms
7,808 KB |
testcase_02 | AC | 27 ms
7,808 KB |
testcase_03 | AC | 27 ms
7,936 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 21 ms
7,808 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | AC | 1 ms
5,376 KB |
testcase_14 | AC | 2 ms
5,376 KB |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 1 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 1 ms
5,376 KB |
testcase_23 | AC | 1 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
コンパイルメッセージ
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 Control.Applicative main :: IO () main = solve <$> f >>= mapM_ putStrLn where f = map read <$> words <$> getLine solve :: [Int] -> [String] solve [t, a, b] | mp < 0 = ["NO"] | a == 0 && b == 0 && t == 1 = ["NO"] | a == 0 && b == 0 && even mp = ["YES"] ++ (take mp $ cycle [">", "<"]) | a == 0 && b == 0 = ["YES", ">", "^", "v<"] ++ (take (mp - 3) $ cycle [">", "<"]) | b == 0 && even mp = ["YES"] ++ (take mp $ cycle [">", "<"]) ++ replicate a "^" | b == 0 = ["YES", "^>", "<"] ++ (take (mp - 1) $ cycle [">", "<"]) ++ replicate (a - 1) "^" | a == 0 && even mp = ["YES"] ++ (take mp $ cycle [">", "<"]) ++ replicate b ">" | a == 0 = ["YES", "^>", "v"] ++ (take (mp - 1) $ cycle [">", "<"]) ++ replicate (b - 1) ">" | otherwise = ["YES"] ++ take (mp `div` 2 * 2) (cycle [">", "<"]) ++ (if even mp then ["^>"] else [">","^"]) ++ replicate (min b a - 1) "^>" ++ (if b > a then replicate (b - a) ">" else replicate (a - b) "^") where mp = t - min a b - abs (a - b)