摘要: cdq分治/逆序对 一点点总结 归并排序求普通逆序对问题 #include<bits/stdc++.h> #define IN inline #define R register int using namespace std; const int N=5e5+5; typedef long lon 阅读全文
posted @ 2024-04-25 16:13 Gold_stein 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 分层图的板子题 代码 #include <bits/stdc++.h> #define R(x) x=read() #define fi first #define se second using namespace std; typedef pair<int,int> PII; const int 阅读全文
posted @ 2024-04-12 16:31 Gold_stein 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 概率dp,关键是要走出思维定势: 一般来讲,都会把dp[i]定义为从0爬到高度i的概率,但是因为任何时刻都有掉下去的可能,这样子不好推(也有大佬这样做出来的) 我们把dp[i]定义为从i爬到n的概率,公式就好推了 而且,我们可以根据定义很自然地得到: dp[n]=0 #include <bits/s 阅读全文
posted @ 2024-04-12 12:16 Gold_stein 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 并查集板子题 #include <bits/stdc++.h> #define R(x) x = read() #define RLL(x) x = readLL() using namespace std; typedef long long LL; const int N = 1e5 + 5; 阅读全文
posted @ 2024-04-10 21:34 Gold_stein 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 暴力 一开始还想先分析哪个点会引出最少的分支数量,然后优化顺序。 但是转念一想,既然都写暴力了,就别考虑这么复杂的问题了() 因为题目给的是九宫格类型的拓展,所以最开始写的暴搜是从左上角开始,每次扩展九宫格的搜索方式,搜索完毕之后再进行check 但是这样只有15分 稍作思考一下,便能发现是这个完全 阅读全文
posted @ 2024-04-09 15:22 Gold_stein 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 因式分解之后发现,满足条件的x要么是奇数,要么是4的倍数 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define R(x) x = read() #d 阅读全文
posted @ 2024-04-08 11:05 Gold_stein 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 暴力 直接暴力枚举区间,并且逐个判断 #include <iostream> #include <stdio.h> #include <algorithm> #include <string.h> #include <string> #include <cmath> #define R(x) x = 阅读全文
posted @ 2024-04-08 10:51 Gold_stein 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 问题转化 很容易就能把原问题转化成: 求满足 Max-Min = r-l的区间个数 暴力解法 根据上面得到的性质,我们可以暴力枚举区间,来判断当前区间是否满足性质 #include <iostream> #include <stdio.h> #include <algorithm> #include 阅读全文
posted @ 2024-04-07 17:32 Gold_stein 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 这道题是 P8600 [蓝桥杯 2013 省 B] 连号区间数 的前置知识 #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #define R(x) x = 阅读全文
posted @ 2024-04-07 16:55 Gold_stein 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <string> #include <cmath> #include <string.h> #define R(x) x = read() #define For 阅读全文
posted @ 2024-04-03 22:12 Gold_stein 阅读(7) 评论(0) 推荐(0) 编辑