上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 45 下一页
摘要: 1.首先想到的错解 看到数据范围,就想先写个n^2的暴力:先把所有矩形的面积都算出来,然后再把所有重合的部分挨个减去,把每个重合的部分当成一个个小矩形,用set来判重。 画一个稍复杂些的样例,就会发现,在这些由重合部分产生的小矩形之间,仍有重合,所以这种算法,会导致算出来的重合部分偏大,而导致最后的 阅读全文
posted @ 2023-12-26 12:44 Gold_stein 阅读(67) 评论(1) 推荐(1)
摘要: 二分 #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace s 阅读全文
posted @ 2023-12-22 17:41 Gold_stein 阅读(53) 评论(0) 推荐(0)
摘要: 根据裴蜀定理可得INF的情况是所有数的最大公约数非1 而我们的完全背包的上限是多少呢? 设置为Σai即可,因为把每一个ai用上之后的集合,和ai可以重复使用的集合,只差了整数倍个ai,因此可达性是完全一致的,这里N<=100,ai<=100,所以我们把这个背包的上限设置为10000. #includ 阅读全文
posted @ 2023-12-22 17:18 Gold_stein 阅读(43) 评论(0) 推荐(0)
摘要: 基本可以确定这道题是一个dp,我首先想到的思路是,根据回文序列对称的特性,把这个原序列分成前后两半来做,但是每次对序列进行添加操作,都会导致中心点的移动,导致这种做法非常麻烦,因此需要转换思路: 不妨直接把整个序列颠倒过来,那些本身是回文串的部分,颠倒之后还是回文串,而剩下的那些部分,为了把它们变成 阅读全文
posted @ 2023-12-22 16:58 Gold_stein 阅读(41) 评论(0) 推荐(0)
摘要: 前置知识: 置换环,最小交换次数 https://blog.csdn.net/yunxiaoqinghe/article/details/113153795?ops_request_misc=&request_id=&biz_id=102&utm_term=%E6%9C%80%E5%B0%91%E4 阅读全文
posted @ 2023-12-19 17:45 Gold_stein 阅读(121) 评论(0) 推荐(0)
摘要: 注意,最后统计答案的时候,要把f[1]也考虑进去,也可以直接把f[0]设为1,就能保证正确性了。 #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) f 阅读全文
posted @ 2023-12-17 02:07 Gold_stein 阅读(24) 评论(0) 推荐(0)
摘要: 四个数,当前三个确定时最后一个可以通过前三个所出来,所以只需要枚举前三个 #include <iostream> #include <stdio.h> #include <algorithm> #include <cmath> #include <cstring> #define For(i, j, 阅读全文
posted @ 2023-12-13 00:48 Gold_stein 阅读(42) 评论(0) 推荐(0)
摘要: #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #define For(i, j, n) for(int i = j ; i <= n ; ++i) using namespace std; 阅读全文
posted @ 2023-12-13 00:18 Gold_stein 阅读(26) 评论(0) 推荐(0)
摘要: 1.Floyd写法: #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int N = 26; int n, m; bool d[N][N]; bool st[N]; int 阅读全文
posted @ 2023-12-12 14:05 Gold_stein 阅读(16) 评论(0) 推荐(0)
摘要: 根号分治模板题 #include <iostream> #include <stdio.h> #include <algorithm> #include <cstring> #include <cmath> #define RED "\033[0;32;31m" #define NONE "\033 阅读全文
posted @ 2023-12-11 22:20 Gold_stein 阅读(11) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 45 下一页