結果
問題 | No.777 再帰的ケーキ |
ユーザー | 👑 horiesiniti |
提出日時 | 2019-01-02 05:50:59 |
言語 | Haskell (9.6.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,660 bytes |
コンパイル時間 | 6,720 ms |
コンパイル使用メモリ | 160,860 KB |
実行使用メモリ | 15,896 KB |
最終ジャッジ日時 | 2023-08-10 18:56:56 |
合計ジャッジ時間 | 13,075 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
14,584 KB |
testcase_01 | AC | 3 ms
7,740 KB |
testcase_02 | AC | 3 ms
7,608 KB |
testcase_03 | AC | 3 ms
7,644 KB |
testcase_04 | AC | 2 ms
7,404 KB |
testcase_05 | AC | 3 ms
7,660 KB |
testcase_06 | AC | 3 ms
7,928 KB |
testcase_07 | AC | 3 ms
8,064 KB |
testcase_08 | AC | 3 ms
7,820 KB |
testcase_09 | AC | 3 ms
7,604 KB |
testcase_10 | AC | 3 ms
7,696 KB |
testcase_11 | AC | 3 ms
7,684 KB |
testcase_12 | AC | 3 ms
7,764 KB |
testcase_13 | AC | 3 ms
7,724 KB |
testcase_14 | AC | 3 ms
7,692 KB |
testcase_15 | AC | 2 ms
7,408 KB |
testcase_16 | AC | 3 ms
7,596 KB |
testcase_17 | AC | 2 ms
7,588 KB |
testcase_18 | AC | 3 ms
7,972 KB |
testcase_19 | AC | 3 ms
8,024 KB |
testcase_20 | AC | 3 ms
8,048 KB |
testcase_21 | AC | 142 ms
14,048 KB |
testcase_22 | AC | 142 ms
13,912 KB |
testcase_23 | AC | 12 ms
12,100 KB |
testcase_24 | AC | 12 ms
11,908 KB |
testcase_25 | AC | 152 ms
15,512 KB |
testcase_26 | AC | 152 ms
15,896 KB |
testcase_27 | AC | 22 ms
12,116 KB |
testcase_28 | TLE | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
{-# LANGUAGE ViewPatterns #-} import qualified Data.Sequence as Sq import Data.Sequence (ViewL(..),ViewR(..),(><),(<|),(|>),Seq) import Data.List f::[String]->[(Int,Int,Int)] f []=[] f (s:ss)=let (x:y:c:[])=map read (words s)::[Int] in (x,y,c):f ss left :: Seq a -> a left (Sq.viewl -> (l :< _)) = l left2 :: Seq a -> Seq a left2 (Sq.viewl -> (_ :< ls)) = ls f3::Sq.Seq (Int,Int)->Sq.Seq (Int,Int)->Sq.Seq (Int,Int) f3 old now |Sq.null old=now |otherwise=let a=left old old2=left2 old in f3 old2 (now |> a) f2::Int->Int->Int->Int->[(Int,Int,Int)]->Sq.Seq (Int,Int)->Sq.Seq (Int,Int)->Int f2 _ ans _ _ [] _ _=ans f2 x ans nowC nowC2 xs3@((x2,y2,c2):xs2) old now |x<x2=f2 x2 ans 0 0 xs3 (f3 old now) (Sq.empty :: Sq.Seq (Int,Int)) |Sq.null old=let c4=max (nowC+c2) nowC2 in f2 x (max ans c4) nowC c4 xs2 old (now |> (y2,c4)) |otherwise=let (y3,c3)=left old old2=left2 old c5=(max nowC c3) c6=(max nowC2 (c5+c2)) in if y2 > y3 then f2 x (max ans c6) c5 c6 xs3 old2 (now |> (y3,c5)) else f2 x (max ans c5) nowC nowC2 xs2 old (now |> (y2,(max (nowC+c2) nowC2))) f4::(Int,Int,Int)->Int f4 (a,_,_)=a f5::[(Int,Int,Int)]->[(Int,Int,Int)] f5 (x:[])=[x] f5 ((x,y,c):(x1,y1,c1):xs) |x==x1&& y==y1=f5 ((x1,y1,c1):xs) |otherwise=(x,y,c):f5 ((x1,y1,c1):xs) main = do e<-getLine es<-getContents let q=(Sq.fromList [(0::Int,0::Int)]) xs=f5 $ sort $ f $ lines es print $ f2 (f4 (head xs)) 0 0 0 xs q q