結果
| 問題 | No.545 ママの大事な二人の子供 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-30 18:52:20 |
| 言語 | Haskell (9.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 388 bytes |
| 記録 | |
| コンパイル時間 | 1,447 ms |
| コンパイル使用メモリ | 195,584 KB |
| 実行使用メモリ | 17,952 KB |
| 最終ジャッジ日時 | 2026-05-11 00:48:50 |
| 合計ジャッジ時間 | 9,098 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 TLE * 1 -- * 11 |
コンパイルメッセージ
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:9:19: 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"."
|
9 | left = f (k + head (head ab)) (tail ab)
| ^^^^
Main.hs:9:25: 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"."
|
9 | left = f (k + head (head ab)) (tail ab)
| ^^^^
Main.hs:9:36: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in GHC.Internal.List):
"This is a partial function, it throws an error on empty lists. Replace it with 'drop' 1, or use pattern matching or 'GHC.Internal.Data.List.uncons' instead. Consider refactoring to use "Data.List.NonEmpty"."
|
9 | left = f (k + head (head ab)) (tail ab)
| ^^^^
Main.hs:10:26: 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"."
|
10 | right = f (k - last (head ab)) (tail ab)
| ^^^^
Main.hs:10:37: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in GHC.Inter
ソースコード
import Control.Monad (replicateM)
solve :: [[Int]] -> Int
solve ab = minimum $ map abs $ f 0 ab
f :: Int -> [[Int]] -> [Int]
f k [] = [k]
f k ab = left ++ right where
left = f (k + head (head ab)) (tail ab)
right = f (k - last (head ab)) (tail ab)
main = do
n <- readLn :: IO Int
ab <- map (map read . words) <$> replicateM n getLine :: IO [[Int]]
print $ solve ab