摘要:
题意:带温度最短路。 思路: 我们将温度从小到大的将边加入,用并查集维护连通性。 如果一旦联通那么跑一遍$spfa$就可以得到答案。 复杂度$O(m log m)$ c++ include using namespace std; define ll long long const int maxn 阅读全文
摘要:
题意:求最少LIS覆盖... 思路: 计算$LIS$时我们一般用$dp$表示到当先位置时以当前位置结尾的$LIS$最长长度。 那么这个数组保证单调不降,我们考虑二进制表示。 然后就是转移了... 不过蜜汁$RE$啊,自测能过... c++ include using namespace std; i 阅读全文
摘要:
题意:统计本质不同的串的个数。 思路: 显然后缀自动机,对于每个串建一个$SAM$统计即可。 c++ include using namespace std; int root; int lst; int tot; const int maxn = 2000010; const int mod = 阅读全文
摘要:
题意:自己搜吧。。。 思路: 记二元组$(x,l)$表示当前为$x$且之前有$l$个连续数与$x$相同。 并且维护up和low数组表示取到最大/最小值时,连续序列的长度。 正一遍,反一遍,搞定。 我排序手抖达成$a.r and b.r$,调了1小时... c++ include using name 阅读全文