General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
126814374 Practice:
luogu_bot5
263D - 19 C++14 (GCC 6-32) Accepted 530 ms 10988 KB 2021-08-24 10:14:08 2021-08-24 10:14:08
→ Source
#include<bits/stdc++.h>

using namespace std;

const int N=1e5+7;

vector<int>G[N];
int n,m,K;
int t;
int f[N];

int dfs(int k,int cnt)
{
	f[k]=cnt;
	for(int i=0;i<G[k].size();++i)
	{
		int v=G[k][i];
		if(!f[v])
		{
			dfs(v,cnt+1);
			break;
		}	
		if(f[k]>=f[v]+K)
		{
			cout<<f[k]-f[v]+1<<endl;
		
			cout<<k<<" ";
			t=v;
			return 0;
		}
	}
	if(t!=-1)cout<<k<<' ';
	if(t==k)t=-1;
}

int main()
{
	cin>>n>>m>>K;
	for(int i=1;i<=m;++i)
	{
		int u,v;
		cin>>u>>v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1,1);
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details