上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页
摘要: 原题链接 题解:不要看到多重关系就慌张,其实本质上还是一对一对的关系,所以要提取出来,关键不得不做的信息,然后建图。 代码: #include <iostream> #include <algorithm> #include <cstring> using namespace std; const 阅读全文
posted @ 2021-04-11 11:32 u_yan 阅读(41) 评论(0) 推荐(0)
摘要: P4782 【模板】2-SAT 问题 #include <iostream> #include <algorithm> #include <cstring> using namespace std; const int N = 2e6 + 9; const int M = 2e6 + 9; int 阅读全文
posted @ 2021-04-10 21:46 u_yan 阅读(32) 评论(0) 推荐(0)
摘要: 题目链接 题解:主要是了解了直线交点的求法是根据相似三角形然后用向量起点加上某个比例而成的。 代码: #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #inc 阅读全文
posted @ 2021-04-10 15:53 u_yan 阅读(43) 评论(0) 推荐(0)
摘要: 题解:问题转化很重要,表面上是求是否存在一条直线,然后让所有线段在其投影上有公共部分,其实就是问是否存在一条直线可以穿过所有线段。本质上所有的问题都可以通过遍历点来解决,所以就是遍历每两个点,形成一条直线,然后判每条边是否在两边。 代码: #include <algorithm> #include 阅读全文
posted @ 2021-04-10 11:20 u_yan 阅读(34) 评论(0) 推荐(0)
摘要: 原题链接 题解:普通小模拟。也学到了一些东西,所有的几何题,如果可以整数,那就用int,实在是不行才用double 代码: #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <ios 阅读全文
posted @ 2021-04-10 09:42 u_yan 阅读(28) 评论(0) 推荐(0)
摘要: #include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; const int N = 2800; map<string, int>GotTime; map<string 阅读全文
posted @ 2021-04-09 21:19 u_yan 阅读(82) 评论(0) 推荐(0)
摘要: 原题链接 题意:遍历每个非关键边,预处理出来两个 \(MST\) 中的点到最近公共祖先的最长的边的距离,然后就是 \(\frac{cnt}{sum - Max_{i,j}}\) 枚举 \(i,j\) 即可,简直就和求最小生成树的过程一模一样。 代码: #include <cstring> #incl 阅读全文
posted @ 2021-04-09 09:18 u_yan 阅读(38) 评论(0) 推荐(0)
摘要: 次小生成树 非严格 #include <cstring> #include <iostream> #include <queue> #include <algorithm> #include <vector> using namespace std; const int N = 1111; cons 阅读全文
posted @ 2021-04-09 08:42 u_yan 阅读(38) 评论(0) 推荐(0)
摘要: 原题链接 题解:求非严格次小生成树,先钦定一个最小生成树,枚举每一条非树边。可发现加入枚举的这条边,定能成环,然后再在环上断开最大的是树边的一条边,然后枚举取最小值。为了缩小时间瓶颈,用了倍增法,预处理最小生成树上两个点之间到最近公共祖先的路上最长的边长,然后 \(\log\) 复杂度的查询。 代码 阅读全文
posted @ 2021-04-09 08:40 u_yan 阅读(44) 评论(0) 推荐(0)
摘要: 原题链接 题解:考虑容斥,即假设是有向的完全图,那么边的数量必然是 \(n\times(n-1)\),考虑并不是强连通图,那么最接近的情况即是两个强连通分量,考虑如何形成,那么就是在原图缩完点的基础上,保留一个入度或者出度为零的~~(我就是没想到还有可能是出度为零)~~强连通分量不与除了自己以外的任 阅读全文
posted @ 2021-04-08 20:21 u_yan 阅读(34) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页