![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
uva题解
ltwy123
淡定淡定~
展开
-
uva 11987 删点并查集
题意:三种操作 1. 合并两个集合 2.把x放到y所在的集合 3.输出x所在集合的元素个数和元素的和思路:删点并查集 相当与给每个元素套了一个壳。#include <bits/stdc++.h> using namespace std; int fa[200010]; long long sum[200010]; int num[200010]; int idx[200010]; int getf(原创 2015-08-19 12:07:15 · 426 阅读 · 0 评论 -
uva 1449 AC自动机
题意: 求在匹配串中出现次数最多的模式串。思路: AC自动机裸题。 稍微改一下。。code: #include <iostream> #include <queue> #include <cstring> #include <cstdio> #include <algorithm> #include <map> using namespace std; int hs[1600]; int n;原创 2015-10-08 19:31:06 · 441 阅读 · 0 评论 -
uva 11468 ac自动机+dp
题意: 求最后构成的长度为L的字符串不含有模式串的概率,没一个字符的概率已经给出来了。思路: 自动机构造转移,然后dp[i][j]表示现在是第i步,在j这个状态。 转移方程就很好写了。code:#include <iostream> #include <queue> #include <cstring> #include <cstdio> #include <algorithm> us原创 2015-10-08 21:23:15 · 361 阅读 · 0 评论