結果

問題 No.185 和風
ユーザー 情報学生情報学生
提出日時 2019-08-21 15:45:04
言語 Haskell
(9.6.2)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 399 bytes
コンパイル時間 4,874 ms
コンパイル使用メモリ 162,272 KB
実行使用メモリ 11,408 KB
最終ジャッジ日時 2023-07-30 09:17:22
合計ジャッジ時間 3,058 ms
ジャッジサーバーID
(参考情報)
judge5 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,288 KB
testcase_01 AC 12 ms
11,408 KB
testcase_02 AC 9 ms
11,316 KB
testcase_03 AC 12 ms
11,376 KB
testcase_04 AC 12 ms
11,284 KB
testcase_05 AC 4 ms
8,552 KB
testcase_06 AC 12 ms
11,384 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 Data.List

splitEvery2 :: [Int] -> [[Int]]
splitEvery2 = takeWhile (not . null) . map (take 2) . iterate (drop 2)

main :: IO ()
main = interact $ show . solve . map (\[x, y] -> y - x) . splitEvery2 . map read . tail . words

solve :: [Int] -> Int
solve xs = if t /= 1 
                then -1 
                else if head xs <= 0 then -1 else head xs
    where
        t = length $ group xs
0