当前位置:网站首页>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。
边栏推荐
- 关于Bug处理的一些看法
- 累计出货130亿颗Flash,4亿颗MCU!深度解析兆易创新的三大产品线
- [deep learning]: day 1 of pytorch introduction to project practice: data operation and automatic derivation
- Re14:读论文 ILLSI Interpretable Low-Resource Legal Decision Making
- 向高通支付18亿美元专利费之后,传华为向联发科订购了1.2亿颗芯片!官方回应
- 做题笔记2(两数相加)
- 做题笔记4(第一个错误的版本,搜索插入位置)
- Re13: read the paper gender and racial stereotype detection in legal opinion word embeddings
- 海康威视回应'美国禁令'影响:目前所使用的元器件都有备选
- Semtech launched Lora edge, a geolocation solution for the Internet of things, and the first chip lr1110 is now on the market
猜你喜欢

Re10:读论文 Are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr

Easypoi multi sheet export by template

Unity shader procedural texture

MySQL installation tutorial

Re14:读论文 ILLSI Interpretable Low-Resource Legal Decision Making

Ruoyi集成flyway后启动报错的解决方法

RE14: reading paper illsi interpretable low resource legal decision making

Ugui learning notes (II) Scrollview related

Call DLL file without source code
![[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
随机推荐
【深度学习】:《PyTorch入门到项目实战》第六天:多层感知机(含代码)
如何使用Fail2Ban保护WordPress登录页面
Technology sharing | how to recover the erroneously deleted table and the data in the table?
Unity3d shader achieves ablation effect
Brother Ali teaches you how to correctly understand the problem of standard IO buffer
Rsync service deployment and parameter details
Best cow fences solution
[deep learning]: introduction to pytorch to project practice: simple code to realize linear neural network (with code)
【深度学习】:《PyTorch入门到项目实战》第四天:从0到1实现logistic回归(附源码)
我该如何理解工艺
【深度学习】:《PyTorch入门到项目实战》第七天之模型评估和选择(上):欠拟合和过拟合(含源码)
Call DLL file without source code
[deep learning]: the second day of pytorch introduction to project practice: realize linear regression from zero (including detailed code)
Leetcode9. Palindromes
[deep learning]: day 9 of pytorch introduction to project practice: dropout implementation (including source code)
Record development issues
Summary of kubenertes 1.16 cluster deployment problems
In 2020q2, shipments in the global tablet market soared by 26.1%: Huawei ranked third and Lenovo increased the most!
给定正整数N、M,均介于1~10 ^ 9之间,N <= M,找出两者之间(含N、M)的位数为偶数的数有多少个
RE14: reading paper illsi interpretable low resource legal decision making