http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86270#problem/C#include<iostream>
#include<stdio.h>
#include<vector>
#include<string.h>
#include<algorithm>
using namespace std;
#define min(a, b) a<b?a:b;
#define swap(a, b) {t=a; a=b; b=t;};
#define N 10105
vector<vector<int> > G;
struct node
{
int x, y;
} maps[N];
bool cmp(node a, node b)
{
if(a.x==b.x)
return a.y<b.y;
return a.x<b.x;
}
int n, visit[N], rode[N], father[N];
int Time, ans;
void Init()
{
G.clear();
G.resize(n);
Time=ans=0;
memset(visit, 0, sizeof(visit));
memset(rode, 0, sizeof(rode));
memset(father, 0, sizeof(father));
}
void Tarjan(int u, int fu)
{
visit[u]=rode[u]=++Time;
father[u]=fu;
int len=G[u].size();
int v;
for(int i=0; i<len; i++)
{
v=G[u][i];
if(!visit[v])
{
Tarjan(v, u);
rode[u]=min(rode[v], rode[u]);
}
else if(fu!=v)
rode[u]=min(visit[v], rode[u]);
}
}
void solve()
{
int k=0, t;
for(int i=0; i<n; i++)
if(!visit[i])
Tarjan(i, -1);
for(int i=0; i<n; i++)
{
int v=father[i