結果

問題 No.360 増加門松列
ユーザー okadukiokaduki
提出日時 2016-04-19 12:58:25
言語 Haskell
(9.8.2)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 165,832 KB
実行使用メモリ 9,440 KB
最終ジャッジ日時 2023-08-25 18:37:38
合計ジャッジ時間 1,775 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,440 KB
testcase_01 AC 5 ms
9,304 KB
testcase_02 AC 3 ms
7,996 KB
testcase_03 AC 3 ms
7,392 KB
testcase_04 AC 4 ms
9,428 KB
testcase_05 AC 5 ms
9,220 KB
testcase_06 AC 4 ms
9,336 KB
testcase_07 AC 4 ms
9,332 KB
testcase_08 AC 5 ms
9,304 KB
testcase_09 AC 4 ms
9,332 KB
testcase_10 AC 3 ms
7,692 KB
testcase_11 AC 3 ms
7,500 KB
testcase_12 AC 5 ms
9,416 KB
testcase_13 AC 3 ms
7,620 KB
testcase_14 AC 2 ms
7,264 KB
testcase_15 AC 4 ms
9,320 KB
testcase_16 AC 3 ms
7,228 KB
testcase_17 AC 3 ms
7,292 KB
testcase_18 AC 4 ms
9,268 KB
testcase_19 AC 4 ms
9,304 KB
testcase_20 AC 5 ms
9,332 KB
testcase_21 AC 4 ms
9,372 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

ソースコード

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)) &&(a < 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