Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2014年2月18日

摘要: A typical flood-fill algorithm application (BFS). Not very complex, except only 1 tip: instead of searching for new space, I keep all spaces(occupied or not) in a hash_map that gets updated in a flood-fill.#include #include #include #include #include #include #include #include using namespace std;#i 阅读全文
posted @ 2014-02-18 16:02 Tonix 阅读(213) 评论(0) 推荐(0)

摘要: The default answer to LCS(consecutive or non-consecutive) is DP. Recurrence formula can be found athttp://en.wikipedia.org/wiki/Longest_common_subsequence_problem . Calculation is O(mn) and printing is O(m+n).But this typical DP algorithm triggers TLE, as many others:#include #include #include #incl 阅读全文
posted @ 2014-02-18 14:19 Tonix 阅读(290) 评论(0) 推荐(0)