結果
| 問題 | No.397 NO MORE KADOMATSU |
| コンテスト | |
| ユーザー |
aimy
|
| 提出日時 | 2017-04-29 15:26:57 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 2,000 ms |
| コード長 | 570 bytes |
| 記録 | |
| コンパイル時間 | 1,026 ms |
| コンパイル使用メモリ | 192,896 KB |
| 実行使用メモリ | 29,344 KB |
| 平均クエリ数 | 936.56 |
| 最終ジャッジ日時 | 2026-03-31 15:34:13 |
| 合計ジャッジ時間 | 2,613 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
コンパイルメッセージ
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:23:27: warning: [GHC-63394] [-Wx-partial]
In the use of ‘head’
(imported from Data.List, 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"."
|
23 | ikado ixs = fst $ fst $ head $ filter (\(ix1,ix2) -> snd ix1 > snd ix2) $ zip ixs (tail ixs)
| ^^^^
Main.hs:23:86: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Data.List, 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"."
|
23 | ikado ixs = fst $ fst $ head $ filter (\(ix1,ix2) -> snd ix1 > snd ix2) $ zip ixs (tail ixs)
| ^^^^
[2 of 2] Linking a.out
ソースコード
import Data.List import Data.Ord import System.IO replace i xs = xs1 ++ (x':x:xs2) where (xs1,(x:x':xs2)) = splitAt i xs main = do getLine as <- map read . words <$> getLine let output = nmk as print (length output) mapM_ (putStrLn . unwords . map show) output hFlush stdout getLine nmk :: [Int] -> [[Int]] nmk = reverse . nmk' [] where nmk' acc xs' | sort xs' == xs' = acc | otherwise = let i = ikado (zip [0..] xs') in nmk' ([i,i+1]:acc) (replace i xs') ikado ixs = fst $ fst $ head $ filter (\(ix1,ix2) -> snd ix1 > snd ix2) $ zip ixs (tail ixs)
aimy