# Cod sursa(job #2660895)

Utilizator Data 20 octombrie 2020 19:40:28 Componente biconexe 0 cpp-64 done Arhiva educationala 1.86 kb
``````#include <fstream>
#include <stack>
#include <vector>
#include <iterator>
#include <algorithm>
#define MAXN  100005

using namespace std;

ifstream cin("biconex.in");
ofstream cout("biconex.out");

vector < vector <int> > C;
stack < pair <int, int> > S;
int index, n;

{
int cnt_edges, x, y;

cin >> n;
for (cin >> cnt_edges; cnt_edges > 0; -- cnt_edges)
cin >> x >> y,

cin.close();
}

void stiva(const int x, const int y)
{
vector <int> con;
int tx, ty;

do
{
tx = S.top().first, ty = S.top().second;
S.pop();
con.push_back(tx), con.push_back(ty);
}
while (tx != x || ty != y);
C.push_back(con);
}

void DFS(const int n, const int father, int number)
{

for(int i = 0 ; i < adj[n].size() ; i++)
{

if(u == father) continue ;

if(idx[u] == -1)
{
S.push(make_pair(n, u));
DFS(u, n, number + 1);

stiva(n, u);
}

else
}
}

void print_out()
{
cout << C.size() << "\n";
for (int i = 0; i < C.size(); ++ i)
{
sort(C[i].begin(), C[i].end());
C[i].erase(unique(C[i].begin(), C[i].end()), C[i].end());
for (int j = 0; j < C[i].size(); ++ j)
cout << C[i][j] << " ";
cout << "\n";
}
cout.close();
}

int main(void)
{
int n;