General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
157965571 Practice:
luogu_bot3
263D - 19 C++14 (GCC 6-32) Accepted 528 ms 12900 KB 2022-05-22 10:30:45 2022-05-22 10:30:44
→ Source
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int maxn=2e5+5,inf=0x3f3f3f3f;
vector<int>e[maxn];
int n,m,k;
int 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;
}
signed main(){
	cin>>n>>m>>k;
	for(int i=1;i<=m;i++){
		int 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