結果
| 問題 | No.706 多眼生物の調査 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-15 22:08:11 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 2,000 ms |
| コード長 | 275 bytes |
| 記録 | |
| コンパイル時間 | 8,854 ms |
| コンパイル使用メモリ | 195,732 KB |
| 実行使用メモリ | 203,576 KB |
| 最終ジャッジ日時 | 2026-04-01 23:24:25 |
| 合計ジャッジ時間 | 2,787 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:11:13: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Prelude, but defined in GHC.Internal.List):
"This is a partial function, it throws an error on empty lists. Use pattern matching, 'Data.List.uncons' or 'Data.Maybe.listToMaybe' instead. Consider refactoring to use "Data.List.NonEmpty"."
|
11 | print $ head . maximumBy (comparing length) . group $ sort as
| ^^^^
[2 of 2] Linking a.out
ソースコード
module Main where
import Control.Monad
import Data.Ord (comparing)
import Data.List (sort, group, maximumBy)
main :: IO ()
main = do
n <- readLn
as <- replicateM n $ (subtract 2) . length <$> getLine
print $ head . maximumBy (comparing length) . group $ sort as