摘要: by luogu 范围 一个dp题 #include<bits/stdc++.h> using namespace std; int n,m; char a[555]; int ans=-1111; int dp[555][111][111][3]; char flag[555]; //@xjz i 阅读全文
posted @ 2021-06-18 19:13 Hehe_0 阅读(57) 评论(0) 推荐(0)
摘要: 题面 一个树形dp, 我们根据题意去想如何得到两两距离,发现一条边的两侧每有一对同色点,这条边就要被经过一次 在当前的子节点的子树中,枚举有k个黑点,需要一个在其他子树中选了共 j - k 个黑点的状态 code #include<bits/stdc++.h> #define int long lo 阅读全文
posted @ 2021-06-11 20:26 Hehe_0 阅读(60) 评论(0) 推荐(0)
摘要: 树形dp 其实可以剪纸的 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 5 int n,m; 6 7 int head[1010],nxt[1010],to[1010]; 8 int dp[1010][1010]; 9 //根节点为i,耗费 阅读全文
posted @ 2021-05-29 09:27 Hehe_0 阅读(55) 评论(0) 推荐(0)
摘要: 关于欧拉回路 若为有向图 每个点入度==出度 则存在欧拉回路 若为无向图 每个点所连边为偶数 则存在欧拉回路 看上去很好理解 但是在处理实际问题时 往往要用到并查集/map,和很棘手的操作 有几道题,推一下 [1] (https://www.luogu.com.cn/problem/P1341) 1 阅读全文
posted @ 2021-05-05 22:00 Hehe_0 阅读(93) 评论(0) 推荐(0)
摘要: by luogu 我们将它用dp的思想来推一下 再进一步思考 可以发现 斐波那契! 再利用上矩阵递推 (我打印出来了1~12的ans、并找到了规律 1 #include<bits/stdc++.h> 2 3 4 #define M 1000000007 5 #define int long long 阅读全文
posted @ 2021-05-03 17:53 Hehe_0 阅读(45) 评论(0) 推荐(0)
摘要: 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 int f[100001]; 5 int a[100001]; 6 7 struct node 8 { 9 int x,y,z; 10 }b[100001]; 11 12 int find(in 阅读全文
posted @ 2021-05-03 17:46 Hehe_0 阅读(71) 评论(0) 推荐(0)
摘要: 很明显的拓扑 推一波: https://www.luogu.com.cn/blog/Hehe-0/p2017-dizzy-cows-g 1 #include<bits/stdc++.h> 2 3 4 using namespace std; 5 const int mmm=1e6+1; 6 7 in 阅读全文
posted @ 2021-05-03 15:23 Hehe_0 阅读(100) 评论(0) 推荐(0)
摘要: ... 很明显的一个强连通分量的(水)题 当我看到题面时,想到了很多邪门做法,但应该不可行 此题 统计大小,和牛的关系 出度为0的是明星 id新号,a是出度 1 #include<bits/stdc++.h> 2 3 using namespace std; 4 const int mmm=5e4+ 阅读全文
posted @ 2021-05-03 11:52 Hehe_0 阅读(73) 评论(0) 推荐(0)
摘要: by luogu 可用于练习线段树 这里涉及到了开方操作 和 + * 不同,它的运算次数大大减小 只有大概8次操作就会到1 而1无论开多少次的方 都是1 所以可以去掉懒标了 这里的mark所记录的是区间最大值 若最大值都为1,那么也就吗,没有必要再进行计算 但是修改的话 还是需要一次到底(l==r) 阅读全文
posted @ 2021-04-28 21:44 Hehe_0 阅读(47) 评论(0) 推荐(0)
摘要: 给定一个仅包含小写英文字母的字符串,求该字符串含有的本质不同的子串数量。 注:这道题是 SPOJ-694 的加强版 #include<bits/stdc++.h> using namespace std; //SAM 统计本质不同的子串个数 int fail[100050],len[100050]; 阅读全文
posted @ 2021-04-24 11:34 Hehe_0 阅读(92) 评论(0) 推荐(0)