結果
| 問題 | No.376 立方体のN等分 (2) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-07-29 03:03:35 | 
| 言語 | Haskell (9.10.1) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 508 bytes | 
| コンパイル時間 | 1,920 ms | 
| コンパイル使用メモリ | 170,368 KB | 
| 実行使用メモリ | 16,420 KB | 
| 最終ジャッジ日時 | 2024-11-06 18:19:16 | 
| 合計ジャッジ時間 | 24,892 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 14 TLE * 1 -- * 23 | 
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
divisors k = filter (\ x -> k `rem` x == 0)
divisors2 i n = map (\ x -> [x, n `quot` x]) . divisors n . takeWhile (\ x -> x ^ 2 <= n) $ [i .. ]
divisors3 n = concat . map (\ x -> map (x : ) $ divisors2 x (n `quot` x)) . divisors n . takeWhile (\ x -> x ^ 3 <= n) $ [1 .. ]
evaluate (p : q : r : []) = (p - 1) + (q - 1) + (r - 1)
solveMin = minimum . map evaluate . divisors3
solveMax = (+ (-1))
main = do
    n <- readLn :: IO Integer
    putStrLn $ (show . solveMin) n ++ " " ++ (show . solveMax) n
    
            
            
            
        