結果

問題 No.360 増加門松列
ユーザー okaduki
提出日時 2016-04-18 14:24:18
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 1,676 ms
コンパイル使用メモリ 174,080 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-10-04 13:30:18
合計ジャッジ時間 2,458 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Control.Monad
import Data.List
import Control.Applicative

answer True = "YES"
answer False = "NO"

is_kado a b c = (a /= b && b /= c && a /= c) && ((a < b && b > c) || (a > b && b < c))
is_kados (a:b:c:xs) = is_kado a b c && is_kados (b:c:xs)
is_kados _ = True
solve True = putStrLn "YES"
solve _ = putStrLn "NO"

main = do
  xs <- fmap (read :: String -> Int) . words <$> getLine
  solve $ or $ map is_kados $ permutations xs
0