hiho week 53 register

Ended

Participants:396

Verdict:Accepted
Score:100 / 100
Submitted:2015-07-07 19:41:39

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <algorithm>
using namespace std;
struct EDGE{
    int to;
    struct EDGE* next;
}e[200010];
struct EDGE* p[20010]={NULL};
int ssize=0,size=0,tt=0,total=0,sta[20010],ans[20010],dfn[20010],low[20010],f[20010],mid[20010];
bool vis[20010]={false};
void addedge(int a,int b)
{
    e[size].to=b;e[size].next=p[a];
    p[a]=e+size;size++;
}
void dfs(int u)
{
    vis[u]=true;
    dfn[u]=low[u]=++tt;
    sta[ssize++]=u;
    for(struct EDGE* temp=p[u];temp;temp=temp->next){
        int v=temp->to;
        if(!vis[v]){
            f[v]=u;
            dfs(v);
            low[u]=min(low[u],low[v]);
        }
        else if(f[u]!=v)
            low[u]=min(dfn[v],low[u]);
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX