看书情况:109~124页 刷题数:6 今天把上两次比赛的该补的题都补了,补题有博客,还写了两道书上例题的博客。 书上例题 BFS思维https://www.cnblogs.com/2462478392Lee/p/11291434.html 二分+双向DFShttps://www.cnblogs.c Read More
posted @ 2019-08-02 22:29 Ldler Views(102) Comments(0) Diggs(0) Edit
题目链接 题意:就是求每个点到最近的1的距离,但距离是|xi-x|+|yi-y|。 思路:将每个是1的点BFS全图,想到了就是很水的BFS。 #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #includ Read More
posted @ 2019-08-02 21:59 Ldler Views(297) Comments(0) Diggs(0) Edit
题目链接 题意:给你n个礼物重量,给你一个M力量,看你一次性搬动不超过M的礼物重量。 思路:看似背包,但M太大。所以要用DFS,但n也有45,所以考虑双向DFS先搜前半部分满足情况的所有重量,然后去重,再往后半部分搜索,并二分找答案。 #include<cstdio> #include<cstrin Read More
posted @ 2019-08-02 21:49 Ldler Views(214) Comments(0) Diggs(0) Edit
题目链接 题意: 思路:只要求出矩阵{{a,b}{1,0}}的n-1次方就能得出答案。学习了网上的十倍快速幂https://blog.csdn.net/To_the_beginning/article/details/88367974。 #include<cstdio> #include<cstri Read More
posted @ 2019-08-02 19:10 Ldler Views(145) Comments(0) Diggs(0) Edit
题目链接 题意:每次给出两个字母 和 只有这两个字母的原字符串的子序列,最后让你输出原字符串。 思路:先将字符转换为hash值,然后再转换成图,就是一个拓扑排序了,然后满足不了的情况有两种,一个是构造不了给出的n字符串大小,还有就是字母去重后多了。 #include<cstdio> #include Read More
posted @ 2019-08-02 19:02 Ldler Views(186) Comments(0) Diggs(0) Edit