結果

問題 No.360 増加門松列
ユーザー HaarHaar
提出日時 2016-04-17 22:54:44
言語 Haskell
(9.6.2)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 3,455 ms
コンパイル使用メモリ 163,532 KB
実行使用メモリ 9,668 KB
最終ジャッジ日時 2023-08-25 18:34:27
合計ジャッジ時間 1,954 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
9,620 KB
testcase_01 AC 5 ms
9,460 KB
testcase_02 AC 3 ms
8,040 KB
testcase_03 AC 3 ms
7,412 KB
testcase_04 AC 5 ms
9,604 KB
testcase_05 AC 4 ms
9,356 KB
testcase_06 AC 4 ms
9,588 KB
testcase_07 AC 4 ms
9,360 KB
testcase_08 AC 5 ms
9,364 KB
testcase_09 AC 5 ms
9,524 KB
testcase_10 AC 3 ms
7,768 KB
testcase_11 AC 3 ms
7,408 KB
testcase_12 AC 5 ms
9,668 KB
testcase_13 AC 3 ms
7,700 KB
testcase_14 AC 2 ms
7,132 KB
testcase_15 AC 4 ms
9,356 KB
testcase_16 AC 2 ms
7,424 KB
testcase_17 AC 2 ms
7,316 KB
testcase_18 AC 5 ms
9,540 KB
testcase_19 AC 5 ms
9,528 KB
testcase_20 AC 4 ms
9,336 KB
testcase_21 AC 5 ms
9,564 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 )

Main.hs:5:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in 9 further locations.
    Suggested fix: Please use spaces instead.
  |
5 |         where max = maximum [a,b,c];
  | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

import Data.List

isKadomatsu :: Integer -> Integer -> Integer -> Bool
isKadomatsu a b c = (a /= b && b /= c && a /= c) && (b == max || b == min)
	where max = maximum [a,b,c];
		  min = minimum [a,b,c];

isIncreasedKadomatsu :: [Integer] -> Bool
isIncreasedKadomatsu (a:b:[]) = True
isIncreasedKadomatsu (a:b:c:xs) =
	if a < c && isKadomatsu a b c
		then isIncreasedKadomatsu (b:c:xs)
		else False

main = do
	seq <- getLine >>= return . permutations . map (read::String->Integer) . words
	putStrLn $ if or (map isIncreasedKadomatsu seq) then "YES" else "NO"
0