sicily 1176 Two Ends dp(记忆化搜索)

来源:互联网 发布:为知笔记 注册码 编辑:程序博客网 时间:2024/05/04 08:40

今天在网络中心上班,看到他们在做这题,吃饭后我也来做,刚开始看,就直接想暴力dfs,看了一下status,130个TLE,断定不行了,哈哈,我算法分析不行,只能这样看。

然后想了一下,其实也是最优问题,dp可以解决,不过还是WA了一次,因为没留意When employing the greedy strategy, always take the larger end. If there is a tie, remove the left end.这个条件。加等号就A了

 

原创粉丝点击