Cod sursa(job #2928401)

Utilizator YusyBossFares Yusuf YusyBoss Data 22 octombrie 2022 21:05:28
Problema Ciclu Eulerian Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.5 kb
#include <bits/stdc++.h>
#define NMAX 100000
#define MMAX 500000

using namespace std;

ifstream fin ("ciclueuler.in");
ofstream fout ("ciclueuler.out");

struct strson {
  int node;
  int index;
};

//bool is_used_edge[MMAX + 1];
stack <strson> vsons[NMAX + 1];
//vector <int> vcicle;

//bool is_eulerian_graph(int n) {
//  int i;
//
//  i = 1;
//  while (i <= n && vsons[i].size() % 2 == 0)
//    i++;
//
//  return 0;
//}
//
//bool check_last_son(int node) {
//  strson top = vsons[node].top();
//  return is_used_edge[top.index];
//}
//
//void dfs(int node) {
//  while (!vsons[node].empty() && check_last_son(node))
//    vsons[node].pop();
//
//  if (!vsons[node].empty()) {
//    //vcicle.push_back(node);
//    strson top = vsons[node].top();
//    vsons[node].pop();
//    is_used_edge[top.index] = true;
//
//    dfs(top.node);
//  }
//}

int main() {
  int n, m, node1, node2, i;
  fin >> n >> m;

  for (i = 0; i < m; i++) {
    fin >> node1 >> node2;
//    vsons[node1].push({node2, i});
//    vsons[node2].push({node1, i});
  }

//  if (1 == 0) {
//    dfs(1);
//
//    for (i = 1; i <= n; i++) {
//      while (!vsons[i].empty() && check_last_son(i))
//        vsons[i].pop();
//    }
//
//
//    i = 1;
//    while (i <= n && vsons[i].empty())
//      i++;
//
//    if (i > n) {
//      for (i = 0; i < vcicle.size(); i++)
//        fout << vcicle[i] << " ";
//    }
//    else
//      fout << -1;
//  }
//  else
    fout << -1;
  return 0;
}