結果
問題 | No.397 NO MORE KADOMATSU |
ユーザー | aimy |
提出日時 | 2017-04-29 15:26:57 |
言語 | Haskell (9.8.2) |
結果 |
AC
|
実行時間 | 60 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 2,483 ms |
コンパイル使用メモリ | 172,156 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 936.56 |
最終ジャッジ日時 | 2024-07-17 00:55:34 |
合計ジャッジ時間 | 4,309 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 26 ms
25,208 KB |
testcase_01 | AC | 22 ms
24,820 KB |
testcase_02 | AC | 22 ms
24,836 KB |
testcase_03 | AC | 29 ms
24,836 KB |
testcase_04 | AC | 24 ms
25,208 KB |
testcase_05 | AC | 29 ms
24,580 KB |
testcase_06 | AC | 31 ms
24,964 KB |
testcase_07 | AC | 32 ms
24,964 KB |
testcase_08 | AC | 24 ms
24,836 KB |
testcase_09 | AC | 24 ms
25,220 KB |
testcase_10 | AC | 60 ms
25,048 KB |
testcase_11 | AC | 24 ms
25,476 KB |
testcase_12 | AC | 42 ms
25,220 KB |
testcase_13 | AC | 47 ms
24,964 KB |
testcase_14 | AC | 47 ms
25,220 KB |
testcase_15 | AC | 46 ms
24,964 KB |
testcase_16 | AC | 23 ms
24,824 KB |
testcase_17 | AC | 22 ms
25,208 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:23:27: 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." | 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.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." | 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)