結果
問題 | No.406 鴨等間隔の法則 |
ユーザー | Naoki_M_ |
提出日時 | 2016-08-13 13:26:34 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 177 ms / 2,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 3,200 ms |
コンパイル使用メモリ | 180,176 KB |
実行使用メモリ | 27,392 KB |
最終ジャッジ日時 | 2024-07-07 11:37:09 |
合計ジャッジ時間 | 7,339 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 51 ms
14,208 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 145 ms
24,704 KB |
testcase_05 | AC | 43 ms
13,568 KB |
testcase_06 | AC | 46 ms
13,568 KB |
testcase_07 | AC | 44 ms
13,952 KB |
testcase_08 | AC | 145 ms
24,704 KB |
testcase_09 | AC | 170 ms
26,496 KB |
testcase_10 | AC | 51 ms
14,208 KB |
testcase_11 | AC | 119 ms
21,632 KB |
testcase_12 | AC | 76 ms
16,640 KB |
testcase_13 | AC | 67 ms
15,488 KB |
testcase_14 | AC | 131 ms
22,784 KB |
testcase_15 | AC | 4 ms
5,888 KB |
testcase_16 | AC | 8 ms
8,448 KB |
testcase_17 | AC | 5 ms
7,552 KB |
testcase_18 | AC | 4 ms
6,784 KB |
testcase_19 | AC | 9 ms
8,704 KB |
testcase_20 | AC | 12 ms
9,216 KB |
testcase_21 | AC | 13 ms
9,088 KB |
testcase_22 | AC | 25 ms
11,136 KB |
testcase_23 | AC | 74 ms
17,152 KB |
testcase_24 | AC | 108 ms
21,760 KB |
testcase_25 | AC | 168 ms
26,880 KB |
testcase_26 | AC | 177 ms
27,392 KB |
testcase_27 | AC | 32 ms
20,480 KB |
testcase_28 | AC | 40 ms
23,808 KB |
testcase_29 | AC | 170 ms
27,264 KB |
testcase_30 | AC | 158 ms
27,008 KB |
testcase_31 | AC | 155 ms
26,368 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:92: 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." | 5 | main = BS.getContents >>= putStrLn . solve [] . sort . map (fst . fromJust . BS.readInt) . tail . BS.words | ^^^^ Main.hs:7:19: 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." | 7 | solve ls [_] = if head ls /= 0 && all (== head ls) (tail ls) then "YES" else "NO" | ^^^^ Main.hs:7:43: 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." | 7 | solve ls [_] = if head ls /= 0 && all (== head ls) (tail ls) then "YES" else "NO" | ^^^^ Main.hs:7:53: 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." | 7 | solve ls [_] = if head ls /= 0 && all (== head ls) (tail ls) then "YES" else "NO" |
ソースコード
import qualified Data.ByteString.Char8 as BS import Data.List import Data.Maybe main = BS.getContents >>= putStrLn . solve [] . sort . map (fst . fromJust . BS.readInt) . tail . BS.words solve ls [_] = if head ls /= 0 && all (== head ls) (tail ls) then "YES" else "NO" solve ls (a0:a1:as) = solve ((a0 - a1):ls) (a1:as)