摘要: 前置: 二分查找, 最长单调不升子序列,最长单调不降子序列(dilworth)。 题解: 可以用来练习手写二分,二分优化的最长上升子序列时间复杂度O(nlogn)。但是坑是非常多的。 代码: #include <bits/stdc++.h> using namespace std; typedef 阅读全文
posted @ 2024-08-20 23:46 Ynyyy 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 解法: 从底往上dp,每次取下一行相邻两个数最大的即可。 代码: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N = 1e3 + 10; int n; int f[N][N]; void s 阅读全文
posted @ 2024-08-20 23:07 Ynyyy 阅读(3) 评论(0) 推荐(0) 编辑