結果

問題 No.406 鴨等間隔の法則
ユーザー SamuSoftSamuSoft
提出日時 2016-10-07 18:32:52
言語 Haskell
(9.8.2)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 2,548 ms
コンパイル使用メモリ 163,936 KB
実行使用メモリ 26,764 KB
最終ジャッジ日時 2023-09-21 18:15:14
合計ジャッジ時間 6,234 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
13,472 KB
testcase_01 AC 2 ms
7,276 KB
testcase_02 AC 2 ms
7,204 KB
testcase_03 AC 2 ms
7,272 KB
testcase_04 AC 192 ms
19,392 KB
testcase_05 AC 72 ms
13,588 KB
testcase_06 AC 82 ms
13,396 KB
testcase_07 AC 82 ms
13,944 KB
testcase_08 AC 192 ms
19,376 KB
testcase_09 AC 212 ms
19,708 KB
testcase_10 AC 92 ms
14,232 KB
testcase_11 AC 162 ms
15,612 KB
testcase_12 AC 112 ms
15,116 KB
testcase_13 AC 102 ms
15,016 KB
testcase_14 AC 272 ms
22,636 KB
testcase_15 AC 21 ms
11,628 KB
testcase_16 AC 22 ms
11,768 KB
testcase_17 AC 12 ms
11,604 KB
testcase_18 AC 21 ms
11,764 KB
testcase_19 AC 32 ms
13,272 KB
testcase_20 AC 42 ms
13,892 KB
testcase_21 AC 32 ms
12,044 KB
testcase_22 AC 72 ms
15,744 KB
testcase_23 AC 112 ms
15,160 KB
testcase_24 AC 232 ms
20,608 KB
testcase_25 AC 212 ms
19,684 KB
testcase_26 AC 342 ms
25,800 KB
testcase_27 AC 192 ms
17,640 KB
testcase_28 AC 193 ms
17,608 KB
testcase_29 AC 342 ms
25,400 KB
testcase_30 AC 332 ms
26,764 KB
testcase_31 AC 202 ms
19,680 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(sort)

main :: IO ()
main = getContents >>= putStrLn . compute . sort . tail . map readInt . words

readInt :: String -> Int
readInt = read

compute :: [Int] -> String
compute (x1:x2:xs)
  | x2-x1 == 0 = "NO"
  | otherwise = checkList xs (x2-x1) x2

checkList :: [Int] -> Int -> Int -> String
checkList [] _ _ = "YES"
checkList (x:xs) diff lst
  | lst == x - diff = checkList xs diff x
  | otherwise = "NO"
0