摘要:
为了物尽其用,Next求出最多有哪部分能重复使用,然后重复使用就行了…… C++ const int maxn = 5e5 + 5; char s[maxn], t[maxn]; int cnts0, cnts1, cntt0, cntt1; int Next[maxn]; int main() { 阅读全文
摘要:
常规的dp,当前有值且碰不到管子就转移,可以连跳的操作我就加了一维表示当前是不是连跳过来的。第二问前缀和即可得(不对啊边走边记录就行了吧我冗了Orz)。 C++ include include include using namespace std; const int maxn = 1e4 + 5 阅读全文
摘要:
题目传送 记得这是我初学dp时的一道题 虽说就像LCS一样搞一搞即可 ~~但我还是写挂了qwq~~ C++ include include include using namespace std; char s[2005], t[2005]; int dp[2005][2005]; int main 阅读全文
摘要:
Codeforces 1107一题除了dp做法还有二分带权匹配O(n^3)做法,国外网友的板子时间非常优秀,但矩阵设定的事情并不是很懂…… C++ //Codeforces 1107F const int maxn = 505; int n; ll a, b, k, Matrix[maxn][max 阅读全文