摘要: dfs 本质上这道题是求割点所在子树大小,但是由于只有两个点,所以直接$dfs$求即可 #include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int n, m, a, b, ca, cb; int vis[ma 阅读全文
posted @ 2019-12-17 18:39 19992147 阅读(103) 评论(0) 推荐(0) 编辑
摘要: dp $dp[i][j][k]$表示第一个串匹配到$i$,第二个串匹配到$j$,前缀和为$k$ 由于前缀和不会超过$n$,所以直接$bfs$转移即可 输出方案记录$dp$前继即可 时间复杂度$O(n^3)$ #include <bits/stdc++.h> using namespace std; 阅读全文
posted @ 2019-12-17 18:37 19992147 阅读(146) 评论(0) 推荐(0) 编辑