結果

問題 No.232 めぐるはめぐる (2)
ユーザー ducktailducktail
提出日時 2018-09-16 16:06:48
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 509 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 163,936 KB
実行使用メモリ 11,404 KB
最終ジャッジ日時 2023-09-25 09:00:20
合計ジャッジ時間 5,421 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 32 ms
11,344 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
7,120 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
7,200 KB
testcase_08 WA -
testcase_09 AC 2 ms
7,208 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
7,128 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,948 KB
testcase_17 AC 3 ms
7,008 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
7,048 KB
testcase_22 AC 3 ms
7,036 KB
testcase_23 AC 3 ms
7,028 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

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"]
  | otherwise = ["YES"] ++
                take (mp `div` 2 * 2) (cycle [">", "<"]) ++
                (if even mp then ["^>"] else [">","^"]) ++
                replicate (min a b - 1) "^>" ++
                (if a > b then replicate (a - b) ">" else replicate (b - a) "^")
  where
    mp = t - min a b - abs (a - b)
0