結果

問題 No.185 和風
ユーザー はむ吉🐹はむ吉🐹
提出日時 2015-10-18 10:49:03
言語 Haskell
(9.6.2)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 346 bytes
コンパイル時間 8,506 ms
コンパイル使用メモリ 158,048 KB
実行使用メモリ 11,472 KB
最終ジャッジ日時 2023-09-28 22:06:27
合計ジャッジ時間 3,491 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
11,320 KB
testcase_01 AC 12 ms
11,312 KB
testcase_02 AC 3 ms
7,276 KB
testcase_03 AC 3 ms
7,256 KB
testcase_04 AC 12 ms
11,472 KB
testcase_05 AC 4 ms
8,788 KB
testcase_06 AC 12 ms
11,360 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 #

solveEquations :: [[Int]] -> Int
solveEquations pairs
    | all (== ans1) anss && ans1 > 0 = ans1
    | otherwise                      = -1
    where
        anss = map (\(x : y : _) -> y - x) pairs
        ans1 = head anss

main :: IO ()
main = do
    _ <- getLine
    print . solveEquations . map (map read) . map words . lines =<< getContents
0