結果
問題 |
No.116 門松列(1)
|
ユーザー |
|
提出日時 | 2021-10-08 15:49:37 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 402 bytes |
コンパイル時間 | 2,644 ms |
コンパイル使用メモリ | 174,976 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 03:22:18 |
合計ジャッジ時間 | 2,995 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 3 |
コンパイルメッセージ
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
ソースコード
solve :: [Int] -> Int solve xs | length xs >= 3 = (if judge (take 3 xs) then 1 else 0) + solve (drop 1 xs) | otherwise = 0 where judge :: [Int] -> Bool judge xs@[a1,a2,a3] = (maximum xs == a2 || minimum xs == a2) && a1 /= a3 judge _ = undefined main :: IO () main = do _ <- getLine a <- map read . words <$> getLine :: IO [Int] print $ solve a