Cod sursa(job #2559420)
| Utilizator | Data | 27 februarie 2020 12:20:34 | |
|---|---|---|---|
| Problema | Ciclu Eulerian | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
#define N 201
using namespace std;
ifstream fin ("ciclueuler.in");
ofstream fout ("ciclueuler.out");
array <bitset <N>, N> a;
int n;
void pseudoDFS (int x) {
for (int i=1; i<=n; i++)
if (a[x][i])
a[x][i]=a[i][x]=0,
pseudoDFS(i);
fout << x << ' ';
}
int main (void) {
int i, j;
fin >> n >> i;
while (fin >> i >> j)
a[i][j]=a[j][i]=1;
pseudoDFS(1);
return 0;
}
