結果
問題 |
No.464 PPAP
|
ユーザー |
![]() |
提出日時 | 2017-03-02 18:34:37 |
言語 | Haskell (9.10.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 509 bytes |
コンパイル時間 | 4,303 ms |
コンパイル使用メモリ | 178,548 KB |
実行使用メモリ | 16,420 KB |
最終ジャッジ日時 | 2024-06-13 01:31:52 |
合計ジャッジ時間 | 7,807 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 3 TLE * 1 -- * 18 |
コンパイルメッセージ
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:10:29: 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." | 10 | p1s = [ length p1 | p1 <- tail $ inits $ take (len-3) src, pali p1 ] | ^^^^ Main.hs:11:48: 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." | 11 | p1p2s = [ (p1, length p2) | p1 <- p1s, p2 <- tail $ inits $ drop p1 $ take (len-2) src, pali p2 ] | ^^^^ [2 of 2] Linking a.out
ソースコード
import Data.List pali xs = xs == reverse xs compute = length . comp4s comp4s src = quads where len = length src p3s = reverse [ length p3 | p3 <- init $ tails $ drop 3 src, pali p3 ] p1s = [ length p1 | p1 <- tail $ inits $ take (len-3) src, pali p1 ] p1p2s = [ (p1, length p2) | p1 <- p1s, p2 <- tail $ inits $ drop p1 $ take (len-2) src, pali p2 ] quads = [ (p1,p2,len - p1 - p2 - p3,p3) | (p1,p2) <- p1p2s, p3 <- takeWhile (len - p1 - p2 >) p3s ] main = do l <- getLine print $ compute l