当前位置:网站首页>22年多校第三场(F的证明
22年多校第三场(F的证明
2022-07-28 16:13:00 【吃花椒的妙酱】
F题
题意:给定一个无向图,每次询问两点x, y,求是否存在一个n的排列,使得第一个元素为x,最后一个元素为y,且排列的任意一个前缀、任意一个后缀都连通。
解法
(发现还不会点双,赶紧入门了一下图论555
不难想到割点相关的东西,不过只是部分东西qaq
此题应该有点双性质入手
乱分类讨论一下
如果uv在同一点双,由点双性质,删任意点都能保持联通,所以直接yes。
如果uv在不同点双,且一共两个点双且相邻。(先不考虑不连通情况)。
也是可以构造排列 p 1 p 2 . . . p n p_1p_2...pn p1p2...pn的,其中 p 1.. p i p1..pi p1..pi属于一个点双, p i + 1 . . . p n p_{i+1}...pn pi+1...pn属于另一个, u = p 1 , v = p n u=p_1,v=p_n u=p1,v=pn
如果有更多点双考虑怎么构造,用点双缩点后,是一棵树。因为uv必须在数组的头尾,这棵树必须是链的形式,uv所在的点双必须在链的头尾。结论感觉挺好想的。
反证法乱证下这棵树是条链:
假设不是链,那至少有三个叶子,设uv所在的点双分别为U,V(U≠V),另一个叶子为T。不妨设U与T的lca为LCA,我们先将UV的路径构造到排列p中,
p 1 . . . p i 对应的是 U − > L C A 这条路径上的点双 p_1...p_i对应的是U->LCA这条路径上的点双 p1...pi对应的是U−>LCA这条路径上的点双, p i + 1 . . . p n 对应的是 U − > L C A 这条路径上的点双 p_{i+1}...p_n对应的是U->LCA这条路径上的点双 pi+1...pn对应的是U−>LCA这条路径上的点双,(省略处不代表是一串连续的下标)
此时还剩T->LCA这条路径上的点双没加入到排列中,考虑如果路径中只有T和LCA两个点,怎么去构造。
由于一个点可能同时属于多个点双,假设点双LCA中连接U,连接T的那个点(LCA,U,T是一个点集!)同时属于LCA,U和T(但是缩点的时候只能暂时被放在一个集合里,假设现在在LCA这个集合),因为这种情况能增加点双之间的连通性,从而更容易构造排列(表达能力不佳qaq),我们设这个关键点为k点。
现在U到V这条路径已经安置在排列中了,考虑加入T。考虑让排列的前缀保持连通性,那一个最优方法就是加入k后,就去放T里的点,假设k后面接上一个T中的点q,我们再看排列后缀,此时后缀V到T条路径是不连通的,因为k在q前面!!!
那么推理到更坏情况更构造不出来了!
证毕
如果uv所在的点双在头尾的话,还要特判一下uv是割点的情况。毕竟以上只能保证构造出uv分离的排列,还要保证uv间的连通性。
注意特判n=2的情况,始终是yes。
边栏推荐
- leetcode9. 回文数
- Probability theory and mathematical statistics Chapter 1
- 给定正整数N、M,均介于1~10 ^ 9之间,N <= M,找出两者之间(含N、M)的位数为偶数的数有多少个
- 大学生参加六星教育PHP培训,找到了薪水远超同龄人的工作
- Realize the reset function of steering wheel UI with touch rotation and finger departure in unity
- 做题笔记4(第一个错误的版本,搜索插入位置)
- [deep learning]: the second day of pytorch introduction to project practice: realize linear regression from zero (including detailed code)
- 浏览器解码过程分析
- Re13: read the paper gender and racial stereotype detection in legal opinion word embeddings
- 【深度学习】:《PyTorch入门到项目实战》第七天之模型评估和选择(上):欠拟合和过拟合(含源码)
猜你喜欢

Add differential pairs and connections in Ad
![[deep learning]: day 1 of pytorch introduction to project practice: data operation and automatic derivation](/img/4e/a41eee56fc0e8d3089f105bcb63155.png)
[deep learning]: day 1 of pytorch introduction to project practice: data operation and automatic derivation

Games101 assignment04 job 04

【深度学习】:《PyTorch入门到项目实战》第五天:从0到1实现Softmax回归(含源码)

Unity shader cartoon style rendering

技术分享 | 误删表以及表中数据,该如何恢复?

Applet: scroll view slides to the bottom by default

浏览器解码过程分析

【深度学习】:《PyTorch入门到项目实战》第二天:从零实现线性回归(含详细代码)
![[deep learning]: model evaluation and selection on the seventh day of pytorch introduction to project practice (Part 1): under fitting and over fitting (including source code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: model evaluation and selection on the seventh day of pytorch introduction to project practice (Part 1): under fitting and over fitting (including source code)
随机推荐
RE14: reading paper illsi interpretable low resource legal decision making
: No such file or directory
Some suggestions on Oracle SQL tuning
Text filtering skills
Using MVC in the UI of unity
parseJson
SUSE CEPH add nodes, reduce nodes, delete OSD disks and other operations – storage6
epoll水平出发何边沿触发
Detailed steps for setting up SUSE storage6 environment – win10 + VMware Workstation
Tcp/ip related
Rsync service deployment and parameter details
Unity shader procedural texture
做题笔记4(第一个错误的版本,搜索插入位置)
SUSE Ceph 快速部署 – Storage6
向高通支付18亿美元专利费之后,传华为向联发科订购了1.2亿颗芯片!官方回应
Unity shader texture animation
记录ceph两个rbd删除不了的处理过程
How should I understand craft
Efficiency comparison of three methods for obtaining timestamp
[deep learning]: day 9 of pytorch introduction to project practice: dropout implementation (including source code)