摘要: LIS nlogn的时间复杂度,之前没有写过。 思路是d[i]保存长度为i的单调不下降子序列末尾的最小值。 更新时候,如果a[i]>d[len],(len为目前最长的单调不下降子序列) d[++len]=a[i] 否则 二分查找 d[j-1] #include #include #include #define LL long long using namespace std; LL re... 阅读全文
posted @ 2018-03-25 21:02 invoid 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Trie树。 要求字典序最小,所以由前到后贪心的选择。建一个trie树维护b数列。 #include #include #include using namespace std; const int maxn = 300000*(20+5) ; const int maxm = 30 + 10; int a[maxn],s[maxn],p0[maxn],p1[maxn],cnt; in... 阅读全文
posted @ 2018-03-25 19:31 invoid 阅读(212) 评论(0) 推荐(0) 编辑