顯示具有 DP 標籤的文章。 顯示所有文章
顯示具有 DP 標籤的文章。 顯示所有文章

2016年3月11日 星期五

[Wunder Fund Round 2016 pD][DP] Hamiltonian Spanning Tree

link
You can view official tutorial here.
Here I will explain some points I consider important when trying to solve the problem.
There may be some mistakes in grammar due to my poor English QAQ.
Any correction of algorithm or grammar is welcomed.

It's not hard to find that x>y and x<y are two different problem: One is to use more tree edges as possible while the other is to use less tree edges.

2016年2月22日 星期一

[Codeforces Round #190 (Div. 1)][DP] Ciel and Gondolas

原題連結
這題的重點在於DP優化中決策點的單調性,有許多性質還是需要參考論文和證明才能懂的
有關於決策點的說明可以參考一下官方題解

2016年2月21日 星期日

[Codeforces Round #313 (Div. 1) pC][DP] Gerald and Giant Chess

原題連結
本來一直往dp[i][j]=dp[i-1][j]+dp[i][j-1]去想......結果不管怎麼弄都逃離不了O(n^2)XD

最後看了codeforces上的tag寫著combinatorics!


才突然想起高中數學也有教,從(0,0)走到(n,m)的捷徑方法數是C(n+m,m),這是解這題的其中一個關鍵

2016年2月5日 星期五

[Uva 1449][AC自動機] Dominating Patterns

原題連結
給出字串集合A和字串B,請找出A中出現在B最多次的字串,如果次數相同則按照出現順序輸出。

2016年2月4日 星期四

[Uva 1106][DP][操作分治] Machine Works

原題連結
 這裡 是這題完整的想法以及支持在線的作法,特地再寫一篇是因為像操作分治一類轉離線後的作法不僅code量少,時間和空間上的表現也都很優秀。

[Uva 1106][DP] Machine Works

原題連結
這道題目真是我見過最坑爹的一道題......

2016年1月31日 星期日

[SPOJ APIO10A][DP] Commando

題目連結
最單純的想法是1D/1D的DP,但是顯然不夠快。
這時候看看SPOJ的tag上寫著Convex Hull,然後就可以無恥的去做凸包優化了。

2016年1月28日 星期四