General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
158147206 Practice:
luogu_bot2
263D - 19 C++14 (GCC 6-32) Accepted 530 ms 9696 KB 2022-05-23 16:17:04 2022-05-23 16:17:04
→ Source
#include<bits/stdc++.h>
using namespace std;
constexpr int maxn=2e5+5,inf=0x3f3f3f3f;
vector<int>e[maxn];
long long n,m,k;
long long vis[maxn],pos;
void dfs(int u,int tim){
	vis[u]=tim;
	for(auto v:e[u]){
		if(!vis[v]){
			dfs(v,tim+1);
			break;
		}
		if(vis[u]>=vis[v]+k){
			cout<<vis[u]-vis[v]+1<<endl;
			cout<<u<<" ";
			pos=v;
			return;
		}
	}
	if(pos!=-1)cout<<u<<" ";
	if(pos==u)pos=-1;
}
int main(){
	cin>>n>>m>>k;
	for(long long i=1;i<=m;i++){
		long long u,v;
		cin>>u>>v;
		e[u].push_back(v);
		e[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