結果

問題 No.185 和風
ユーザー Michae'GonMichae'Gon
提出日時 2015-07-19 04:28:09
言語 Haskell
(9.6.2)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 304 bytes
コンパイル時間 2,418 ms
コンパイル使用メモリ 156,504 KB
実行使用メモリ 11,832 KB
最終ジャッジ日時 2023-09-22 19:11:15
合計ジャッジ時間 1,563 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
11,380 KB
testcase_01 AC 4 ms
9,860 KB
testcase_02 AC 4 ms
9,532 KB
testcase_03 AC 5 ms
9,812 KB
testcase_04 AC 12 ms
11,832 KB
testcase_05 AC 4 ms
8,856 KB
testcase_06 AC 12 ms
11,700 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 #

main = getLine >> getContents >>= print . solve . map (map read . words) . lines

solve :: [[Int]] -> Int
solve xs
    | same xs' && head xs' > 0 = head xs'
    | otherwise = -1
        where
            xs' = map (\[x, y] -> y - x) xs
            same (y : ys) = foldl (\acc x -> y == x && acc) True ys
0