結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー tottoripapertottoripaper
提出日時 2014-12-02 16:55:41
言語 Haskell
(9.8.2)
結果
AC  
実行時間 256 ms / 5,000 ms
コード長 302 bytes
コンパイル時間 9,117 ms
コンパイル使用メモリ 174,592 KB
実行使用メモリ 23,168 KB
最終ジャッジ日時 2024-06-26 07:17:36
合計ジャッジ時間 11,939 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
8,192 KB
testcase_01 AC 254 ms
22,016 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 138 ms
19,968 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 142 ms
15,872 KB
testcase_15 AC 54 ms
12,928 KB
testcase_16 AC 188 ms
19,072 KB
testcase_17 AC 49 ms
12,032 KB
testcase_18 AC 179 ms
19,072 KB
testcase_19 AC 127 ms
15,872 KB
testcase_20 AC 256 ms
23,168 KB
testcase_21 AC 7 ms
8,064 KB
testcase_22 AC 78 ms
12,800 KB
testcase_23 AC 242 ms
20,992 KB
testcase_24 AC 249 ms
21,120 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:9:56: 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."
  |
9 |     cmp x y = (length y `compare` length x) `mappend` (head y `compare` head x)
  |                                                        ^^^^

Main.hs:9:73: 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."
  |
9 |     cmp x y = (length y `compare` length x) `mappend` (head y `compare` head x)
  |                                                                         ^^^^

Main.hs:10:9: 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."
   |
10 |     l = head . head . sortBy cmp . group . sort $ ls
   |         ^^^^

Main.hs:10:16: 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."
   |
10 |     l = head . head . sortBy cmp . group . sort $ ls
   |                ^^^^
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Data.List
import Data.Monoid

main = do
  _ <- getLine
  ls <- map read . words <$> getLine :: IO [Int]
  let
    cmp x y = (length y `compare` length x) `mappend` (head y `compare` head x)
    l = head . head . sortBy cmp . group . sort $ ls
   in print l
0