Pagini recente » Cod sursa (job #1082802) | Cod sursa (job #3163971) | Cod sursa (job #1427968) | Cod sursa (job #1549690) | Cod sursa (job #3268066)
/*
____ ___ _ ___ ____ _
/ ___| / _ \| | |_ _/ ___| / \
\___ \| | | | | | | | / _ \
___) | |_| | |___ | | |___ / ___ \
|____/ \___/|_____|___\____/_/ \_\
*/
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long int
#define pii pair<int,int>
const int NMAX = 2e5+9;
const int MOD = 1e9+7;
int binpow(int n, int k)
{
if (k==0)
{
return 1;
}
int x=binpow(n,k/2)%MOD;
if (k%2==0)
{
return x*x%MOD;
}
else
{
return x*x%MOD*n%MOD;
}
}
ifstream fin ("ciclueuler.in");
ofstream fout ("ciclueuler.out");
#define cin fin
#define cout fout
map<pair<int,int>,int>mep;
int n,i,j,m,a,b;
vector<int>g[NMAX];
vector<int>stiva;
void dfs (int node)
{
while (!g[node].empty())
{
int it = g[node].back();
g[node].pop_back();
if (mep[{node,it}])
{
mep[{node,it}]--,mep[{it,node}]--;
dfs(it);
}
}
cout<<node<<' ';
}
void run_case ()
{
cin>>n>>m;
for (i=1; i<=m; i++)
{
cin>>a>>b;
g[a].pb (b),g[b].pb (a);
mep[{a,b}]++;
mep[{b,a}]++;
}
dfs(1);
}
signed main ()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL),cout.tie ();
int teste;
teste=1;
while (teste--)
{
run_case();
}
}