Cod sursa(job #2559418)

Utilizator s.gabi7Dumitrescu Daniel s.gabi7 Data 27 februarie 2020 12:20:10
Problema Ciclu Eulerian Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.46 kb
#include <bits/stdc++.h>
#define N 201
using namespace std;

ifstream fin ("euler.in");
ofstream fout ("euler.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;
}