上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页
摘要: Maximum Islands 思路:预处理‘L’周围包围‘W’。‘L’独自成为岛屿为最优,我们‘L’,‘W’交替处理的图((x+y)%2为同一个集合),分为两个集合,相邻的‘L’和‘W’有边,同一个集合没边,变成二分图的最大独立集问题,得出最多的互不相邻的点就是最大岛屿数量。因为我们匹配的出发点是 阅读全文
posted @ 2020-06-30 16:07 SummerMingQAQ 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 前置技能:二分图匹配和匈牙利算法的了解。 (最小点覆盖) 概念:用最少的点,让每条边都至少和其中一个点关联 性质:最小点覆盖 = 最大匹配 说明:在二分图中,求出了最大匹配后,容易得出,合理分配最大匹配的点去覆盖,未匹配的点一定与覆盖的的某个点有边。 (最小边覆盖) 概念:用尽量少的不相交简单路径覆 阅读全文
posted @ 2020-06-28 16:45 SummerMingQAQ 阅读(494) 评论(0) 推荐(0) 编辑
摘要: Girls and Boys 思路:二分图中,最大独立集 = 顶点数 - 最小点覆盖(最大匹配),这里没有说明明确的二分图,所以匹配出的是二倍的最大匹配(男配女,女配男)。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstdio 阅读全文
posted @ 2020-06-28 16:28 SummerMingQAQ 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Buggy Robot 思路:dp[inx][x][y],表示用了前inx个指令后的最小费用。 对于一个指令,我们可以选择不走或者走,其他的我们可以添加四个方向的指令与使用过指令后的dp来比较。 1 #include <iostream> 2 #include <algorithm> 3 #incl 阅读全文
posted @ 2020-06-24 15:29 SummerMingQAQ 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 5 using namespace std; 6 7 const int N = 110; 8 int f[N][N]; 9 10 //核心想法://i到达j经过前k 阅读全文
posted @ 2020-06-16 23:48 SummerMingQAQ 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <queue> 5 6 using namespace std; 7 8 #define LL long long 9 #define pb pus 阅读全文
posted @ 2020-06-16 23:07 SummerMingQAQ 阅读(313) 评论(0) 推荐(0) 编辑
摘要: /* mi之间互质 同余方程组 : 设正整数m1.m2.mk两两互素,则方程组 x ≡ a1 (mod m1) x ≡ a2 (mod m2) x ≡ a3 (mod m3) . . x ≡ ak (mod mk) 有整数解, 解为 x ≡ (a1 * M1 * 1/M1 + a2 * M2 * 1 阅读全文
posted @ 2020-06-12 20:47 SummerMingQAQ 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 6 using namespace std; 7 8 #define ll long long 9 10 const int 阅读全文
posted @ 2020-06-12 11:11 SummerMingQAQ 阅读(190) 评论(0) 推荐(0) 编辑
摘要: G Gaming with Mia 思路:我们能找出某些情况: -1 1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 1 ... 1 -1 我们发现如果大于5个数相乘,则它一定可以分解成其他更优的情况相乘再相加。(当然如果出现0,也可以最极限情况5个数相乘) 时间复杂度就是:O(1e6* 阅读全文
posted @ 2020-06-10 20:02 SummerMingQAQ 阅读(353) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <vector> 5 #include <queue> 6 using namespace std; 7 #define pb push_back 阅读全文
posted @ 2020-06-05 19:46 SummerMingQAQ 阅读(244) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页