I want to beat dynamic programming - edit distance

392. Judgment subsequence 1. Title Given the strings S and t, judge whether s is a subsequence of t. A subsequence of a string is a new string formed by deleting some (or not deleting) characters from the original string without changing the relative position of the remaining characters. (for example, "ace" is a subsequence of &quo ...

Added by k9underdog on Thu, 03 Feb 2022 11:23:21 +0200

Using Rand to construct rand(10)

Title: if there is a function rand(0,7) - take a natural number randomly from 0 to 7, ask how to use this function to construct rand(0,10) - take a natural number randomly from 0 to 10. PS: this topic is implemented on the premise that rand(10) has no ready-made function. It must be constructed through rand(7) (Note: pay attention to the dist ...

Added by jeffduck on Thu, 03 Feb 2022 10:44:00 +0200

Variety of Digits (dp)

Variety of Digits [Link](F - Variety of Digits (atcoder.jp)) meaning of the title Give you a number n n n. And m m m single digits, ask 1 ...

Added by VenusJ on Thu, 03 Feb 2022 09:28:36 +0200

2019 Nanjing railway station (Revisiting the Classics)

Introduction Knowledge points involved Thinking, multiplicative inverse, combinatorial mathematics, topological sorting, DP, bipartite graph, maximum weight matching, plane geometry Link: Nanjing 2019 regional competition [Cloned] subject A Give a positive integer n and find the smallest integer k to make the set ...

Added by sirfartalot on Thu, 03 Feb 2022 08:36:31 +0200

cses dynamic programming

Counting Towers Main idea of the title: Build a n × 2 n \times 2 n × The rectangle of 2 can only be constructed with a rectangle. Ask how many different options there are. Solution: The division status is whe ...

Added by mb81 on Thu, 03 Feb 2022 03:00:43 +0200

Miaomiao brush force buckle (PTA Special Edition 2)

introduction I'm trying to write a blog for the first time. I hope you officials will be more tolerant If there are mistakes, I hope you can put them forward. I will correct them in time. Thank you At his best age, he found his future goal There is still one year to struggle and brush questions. Go to interview and practice next year. Come ...

Added by xX_SuperCrazy_Xx on Thu, 03 Feb 2022 01:55:51 +0200

Solutions to the three problems of yibentong interceptor missile (noip 1999) + interceptor missile (noip 1999) + interceptor missile

Question 1 [1322: [example 6.4] interceptor missile problem (noip 1999)] [Title Description] In order to defend against the missile attack of the enemy country, a certain country has developed a missile interception system, but this interception system has a defect: although its first shell can reach any height, each shell in the future ca ...

Added by kryppienation on Wed, 02 Feb 2022 17:45:00 +0200

Improvement of dynamic programming method for LCS problem: time complexity O (Mn * (min (m, n)), space complexity O

LCS problem is the problem of finding the longest common subsequence of two strings. The common solutions to this problem are ordinary recursive method and dynamic programming method. The general recursive method adopts the ideas of reducing and governing and dividing and governing. However, the algorithm has a large number of repeated calcula ...

Added by kanchan on Wed, 02 Feb 2022 11:21:12 +0200

Dp from introduction to mastery 2.1 (linear DP, ascending subsequence, common subsequence)

emmm,dp problem is really magical. If you want to get the equation of state, you can take off immediately. If you can't think of it and have no idea, then It is suggested to write after a good meal. It may be faster In fact, dp is more an experience. If you see more, you will write faster, because the state of this kind of questions means that ...

Added by skovela on Tue, 01 Feb 2022 19:06:07 +0200

Codeforces Round #769 (Div. 2): E1. Distance Tree (easy version)

Distance tree Limited ability, only understand easy version Meaning: Given a tree with n nodes, d ( v ) d(v) d(v) represents the shortest distance from any point to 1 po ...

Added by arianhojat on Tue, 01 Feb 2022 18:33:05 +0200