[CF]Cycling City
题目大意:给定一张无向图,问图中是否存在两个点,使得这两个点之间有三条路径,而且三条路径没有公共点。
解法:
我们可以先走出来一个环,再出环上任意一点走到另外一点。就像这样:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArsAAAGCCAIAAABvnJwtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABfJSURBVHhe7dvbgfPIcYBRx+WAnIneHYYjcDIORpZGH/SDS2JAzvDSDZzzpq4CyWFd2Fqt/uPvAAB73BgAgH1uDADAPjcGAGCfGwMAsM+NAQDY58YAAOxzYwAA9rkxAAD73BgAgH1uDADAPjcGAGCfGwMAsM+NAQDY58YAAOxzYwAA9rkxAAD73BgAgH1uDADAPjcGAGCfGwMAsM+NAQDY58YAAOxzYwAA9rkxAAD73BgAgH1uDADAPjcGAGCfGwMAsM+NAU7hP16stwGOy5zD3PrFnkQfGpiQAYYJ9Ht7aP2pwKhMKYyl30++9KUAAzCQ8GH9NnKHvjLgE0wgvFU/fe/Ve79Yb/ZevTfweuYNXqtftpfpbSbRh36Z3gZ4AQMGz9fP1/P0uofWn/pUvTTwDCYKnqPfqGfoFU+vr+MZekXgFwwS/Fw/R7/Ta3GHvrLf6bWABxkeeEw/O7/QC/FrfaG/0AsBdzAwsK+flx/pJXiLvvQf6SWADYYENvVL8rie56MqxuN6HrhkNuCv+t14UA8zpIr0oB4GvhgJSL8SD+phJlHZHtTDcG4mgbPrN+ERPcnkKucjehJOyQBwUv0C3K3HOKjKfLcegzPR95xOK/8+PcNpVPi79RicgHbnLFrw9+kZTqxWuE/PwKFpdA6ujX6fnoGVmuM+PQNHpL85rFb4HXoAvlW73KEH4Fh0NgfU2t5TNjyoBtpTNhyFnuZQWtXfKhV+rZbaUzZMTitP5n/+53/+9re/9R9YtJj3lA1PVXvtKRumpYkn84/rgtWz9q9d/L1S4cVquG+VChPSvsyqBfytUuGNar5vlQpT0bhMpo27p2z4kBpxT9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D29J6y4UE10J6y4Sj0NIfV2r5DD8C3apc79AAci87m4Frh9+kZWKk57tMzcET6m1Nond+txzixWuFuPQbHpcs5l7b73XqM06jwd+sxOAHtzkm17+/WYxxUZb5bj8GZ6HvOrl+AR/Qk86uid+sxOCUDAOk34RE9yVQq3iN6Es7NJMBf9SvxoB5mSBXpQT0MfDESsKnfjcf1PB9VMR7X88AlswH7+iX5kV6Ct+hL/5FeAthgSOAx/bz8Qi/EM/Sd/lSvAtzBwMDP9bPzO70Wd+gr+51eC3iQ4YHn6Ofo13o5vvSl/FovB/yCQYIn6zfqqXrpQ+tPfapeGngGEwWv1W/Xa/QeU+mjv0bvAbyAAYO36pftvXrvF+vN3qv3Bl7PvMEn9bvH3frigLczfjCWfhj50pcCDMBAwgT6/Ty0/lRgVKYUJtaP7VT66MBsTC8cX7/Vr9Q7AcdlzgGAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMA+NwYAYJ8bAwCwz40BANjnxgAA7HNjAAD2uTEAAPvcGACAfW4MAMCev//9/wHI9AiXPKDorQAAAABJRU5ErkJgggA=" alt="" width="439" height="242" />
这种图有什么性质?有环。
这是什么图我们可能不知道,但是我们知道这不是什么图啊!这张图一定不是仙人掌!
然后就是如何判断仙人掌和如何输出答案的问题了
参考了这个大佬的博客,我们了解到,可以利用返祖边来判断仙人掌
显然仙人掌中的一条边不能同时出现两个环内
正如大佬所说的“如果一条树边被两条或者以上的返祖边覆盖,那么图就肯定不是一个仙人掌”
我们建出DFS树,可以发现,第一条返祖边能确定一个环,而第二条返祖边能确定三条路径的起点和终点
设起点深度小,终点深度大,我们可以发现终点是两个返祖边中深度最大的两个点的LCA
而起点则是第二条返祖边上深度最大的点与DFS树上一点相连接的一点
然后再xjbDFS一下输出路径即可代码:
#include<iostream>
#include<cstdio>
#include<cstring>
#define M 200010
using namespace std;
struct point{
int to,next;
}e[M<<];
int n,m,num,top,l1,l2,r1,r2,S,T;
int ans[M],head[M],deep[M],f[M];
int fa[M][];
bool vis[M];
void add(int from,int to)
{
e[++num].next=head[from];
e[num].to=to;
head[from]=num;
}
void dfs(int x)
{
vis[x]=true;
for(int i=head[x];i;i=e[i].next)
{
int to=e[i].to;
if(to==fa[x][]) continue;
if(!vis[to])
{
deep[to]=deep[x]+;
fa[to][]=x;
dfs(to);
}
else if(deep[to]<deep[x])//返祖
{
f[to]--;
f[x]++;
}
}
f[fa[x][]]+=f[x];
}
void DFS(int x)
{
for(int i=head[x];i;i=e[i].next)
{
int to=e[i].to;
if(to==fa[x][]) continue;
if(deep[to]==deep[x]+)
{
DFS(to);
if(l2) return;
}
else if(deep[to]<deep[S])//找到两条返祖边
{
if(l1) r2=x,l2=to;
else r1=x,l1=to;
if(l2) return;
}
}
}
int lca(int x,int y)
{
if(deep[x]<deep[y]) swap(x,y);
for(int i=;i>=;i--)
if(deep[fa[x][i]]>=deep[y])
x=fa[x][i];
if(x==y) return y;
for(int i=;i>=;i--)
if(fa[x][i]!=fa[y][i])
{
x=fa[x][i];
y=fa[y][i];
}
return fa[x][];
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=;i<=m;i++)
{
int x,y; scanf("%d%d",&x,&y);
add(x,y); add(y,x);
}
for(int i=;i<=n;i++)
if(!vis[i])
dfs(i);
for(int i=;i<=n;i++)
if(f[i]>)
{
S=i;
break;
}
if(S==) {printf("NO"); return ;}
printf("YES\n");
DFS(S);
for(int j=;j<=;j++)
for(int i=;i<=n;i++)
fa[i][j]=fa[fa[i][j-]][j-];
T=lca(r1,r2);
if(deep[l1]<deep[l2]) swap(l1,l2),swap(r1,r2);
S=l1;
int now=T;
top=;
while()
{
ans[++top]=now;
if(now==S) break;
now=fa[now][];
}
printf("%d ",top);
for(int i=top;i>=;i--) printf("%d ",ans[i]);
printf("\n");
top=;
ans[++top]=S;
now=r1;
while()
{
ans[++top]=now;
if(now==T) break;
now=fa[now][];
}
printf("%d ",top);
for(int i=;i<=top;i++) printf("%d ",ans[i]);
printf("\n");
top=;
if(S==l2)
{
ans[++top]=S;
now=r2;
while()
{
ans[++top]=now;
if(now==T) break;
now=fa[now][];
}
}
else
{
now=S;
while()
{
ans[++top]=now;
if(now==l2) break;
now=fa[now][];
}
now=r2;
while()
{
ans[++top]=now;
if(now==T) break;
now=fa[now][];
}
}
printf("%d ",top);
for(int i=;i<=top;i++) printf("%d ",ans[i]);
return ;
}
[CF]Cycling City的更多相关文章
- 「CF521E」 Cycling City
「CF521E」 Cycling City 传送门 首先你能发现这个东西一定是两个环的公共边. 最开始想的是什么如果一个点被访问过三次那它一定是公共边的某一端之类的东西,然后发现被仙人掌叉掉. 然后就 ...
- Cycling City CF521E
Cycling City 毒瘤题 首先建dfs树,由于是个无向图所有返祖边都是连向祖先的. 判是否有解其实很简单,只要图不是一个仙人掌就有解了. 仙人掌有关可以看这个博客 但是这道题由于要输出路径成功 ...
- Codeforces 521 E cycling city
cf的一道题,非常有意思,题目是问图中是否存在两个点,使得这两个点之间有三条路径,而且三条路径没有公共点. 其实就是判断一下是否为仙人掌就行了,如果不是仙人掌的话肯定就存在,题目难在输出路径上,改了半 ...
- Codeforces 521E - Cycling City(点双连通分量+分类讨论)
Codeforces 题面传送门 & 洛谷题面传送门 大家都是暴力找生成树然后跳路径,代码不到 50 行(暴论)的一说--好,那本蒟蒻决定提供一种代码 150 行,但复杂度也是线性的分类讨论做 ...
- Cassandra 的数据存储结构——本质是SortedMap<RowKey, SortedMap<ColumnKey, ColumnValue>>
Cassandra 的数据存储结构 Cassandra 的数据模型是基于列族(Column Family)的四维或五维模型.它借鉴了 Amazon 的 Dynamo 和 Google's BigTab ...
- URAL 1966 Cycling Roads 点在线段上、线段是否相交、并查集
F - Cycling Roads Description When Vova was in Shenzhen, he rented a bike and spent most of the ...
- BZOJ1628: [Usaco2007 Demo]City skyline
1628: [Usaco2007 Demo]City skyline Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 256 Solved: 210[Su ...
- (中等) CF 576D Flights for Regular Customers (#319 Div1 D题),矩阵快速幂。
In the country there are exactly n cities numbered with positive integers from 1 to n. In each city ...
- [cf contest697] D - Puzzles
[cf contest697] D - Puzzles time limit per test 1 second memory limit per test 256 megabytes input s ...
随机推荐
- 我如何让echarts实现了分组(原创插件echarts.group代码分享)
前言 echarts是百度出品的一款很棒的前端图表控件,被评为“百度少有的良心产品”.可以实现散点图.折线图.柱状图.地图.饼图.雷达图.K线图等等几十种常用.不常用的图表,效果酷炫. 示例地址:ht ...
- CentOS 7安装与配置jdk-8u162
一.下载jdk-8u162版本 jdk-8u162-linux-x64.rpm 二.上传jdk到centos下 上传完后的文件如下,文件只有读写权限,没有执行权限 使用如下命令授权,如果文件已经有了执 ...
- hdu3625(第一类斯特林数)
与第二类有些区别! #include <stdio.h> #include <stdlib.h> #include <string.h> #include < ...
- <pre>标签让<textarea>标签的内容原样输出
当通过<textarea>插数据进数据的库,取出来后都变成一行变成,用这个<pre>标签能原样输入插入时的格式. 当时要对<pre>加一些CSS样式才行啦. 以下为 ...
- beetl模板的${!}用法
转自:http://ibeetl.com/guide/#beetl 2.20. 安全输出 安全输出是任何一个模板引擎必须重视的问题,否则,将极大困扰模板开发者.Beetl中,如果要输出的模板变量为nu ...
- 剩余参数(rest arguments) Mixin
Mixin – Pug 中文文档 https://pug.bootcss.com/language/mixins.html 混入 Mixin 混入是一种允许您在 Pug 中重复使用一整个代码块的方法. ...
- Python菜鸟之路:Django ModelForm的使用
一.简单使用案例 #views.py #views.py from django.shortcuts import render,HttpResponse from app01 import mode ...
- redis中默认有多少个哈希槽?
Redis 集群中内置了 16384 个哈希槽,当需要在 Redis 集群中放置一个 key-value时,redis 先对 key 使用 crc16 算法算出一个结果,然后把结果对 16384 求余 ...
- MySQL数据库(2)- 库的操作、表的操作、数据的操作、存储引擎的介绍
一.库的操作 1.系统数据库 执行如下命令,查看系统数据库: mysql> show databases; 参数解释: information_schema: 虚拟库,不占用磁盘空间,存储的是数 ...
- What is tail-recursion
Consider a simple function that adds the first N integers. (e.g. sum(5) = 1 + 2 + 3 + 4 + 5 = 15). H ...