結果
問題 | No.406 鴨等間隔の法則 |
ユーザー | momen999 |
提出日時 | 2019-03-11 23:09:11 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 439 ms / 2,000 ms |
コード長 | 281 bytes |
コンパイル時間 | 8,197 ms |
コンパイル使用メモリ | 176,352 KB |
実行使用メモリ | 44,800 KB |
最終ジャッジ日時 | 2024-07-07 12:37:32 |
合計ジャッジ時間 | 14,110 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 108 ms
22,272 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,940 KB |
testcase_04 | AC | 243 ms
35,328 KB |
testcase_05 | AC | 100 ms
20,992 KB |
testcase_06 | AC | 89 ms
20,992 KB |
testcase_07 | AC | 91 ms
21,120 KB |
testcase_08 | AC | 242 ms
35,584 KB |
testcase_09 | AC | 276 ms
42,624 KB |
testcase_10 | AC | 106 ms
22,784 KB |
testcase_11 | AC | 226 ms
35,328 KB |
testcase_12 | AC | 157 ms
29,184 KB |
testcase_13 | AC | 131 ms
28,032 KB |
testcase_14 | AC | 335 ms
38,656 KB |
testcase_15 | AC | 16 ms
9,984 KB |
testcase_16 | AC | 24 ms
11,136 KB |
testcase_17 | AC | 12 ms
9,088 KB |
testcase_18 | AC | 20 ms
10,880 KB |
testcase_19 | AC | 29 ms
11,648 KB |
testcase_20 | AC | 42 ms
13,952 KB |
testcase_21 | AC | 43 ms
13,824 KB |
testcase_22 | AC | 79 ms
19,200 KB |
testcase_23 | AC | 151 ms
30,720 KB |
testcase_24 | AC | 295 ms
38,400 KB |
testcase_25 | AC | 287 ms
42,752 KB |
testcase_26 | AC | 438 ms
44,672 KB |
testcase_27 | AC | 271 ms
42,496 KB |
testcase_28 | AC | 267 ms
41,472 KB |
testcase_29 | AC | 439 ms
44,800 KB |
testcase_30 | AC | 427 ms
42,624 KB |
testcase_31 | AC | 263 ms
39,296 KB |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:5:15: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Data.List, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 5 | | all (== head xs') xs' = "YES" | ^^^^ Main.hs:8:28: warning: [GHC-63394] [-Wx-partial] In the use of ‘tail’ (imported from Data.List, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 8 | xs' = zipWith (-) (tail xs) (init xs) | ^^^^ [2 of 2] Linking a.out
ソースコード
import Data.List solve xs | any (== 0) xs' = "NO" | all (== head xs') xs' = "YES" | otherwise = "NO" where xs' = zipWith (-) (tail xs) (init xs) main = do getLine xs <- sort . map read . words <$> getLine putStrLn $ solve xs