NOIP挂分秘籍

· · 个人记录

FBI Warning:你将看到的内容极其危险,智慧的人会利用它挂分,而误入歧途的人会用他得分,请慎重食用!!!

NOIP挂分秘籍(待补全):

本人即将面临AFO,生涯回忆如下没人稀罕看的东西

错误的:

void dfs(int x,int fa)
{
    dfn[x]=low[x]=++cnt2;
    s[++top]=x;
    ins[x]=1;
    for(int i=head[x];i;i=e[i].next)
    {
        int to=e[i].to;
        if(!dfn[to])
        {
            dfs(to,x);
            low[x]=min(low[x],low[to]);
        }
        else if(ins[to])
        {
            low[x]=min(low[x],dfn[to]);
        }
    }
    if(dfn[x]==low[x])
    {
        cnt3++;
        while(s[top--]!=x)
        {
            bl[s[top]]=cnt3;
            ins[s[top]]=0;
        }
    }
}

正确的:

void dfs(int x,int fa)
{
    dfn[x]=low[x]=++cnt2;
    s[++top]=x;
    ins[x]=1;
    for(int i=head[x];i;i=e[i].next)
    {
        int to=e[i].to;
        if(!dfn[to])
        {
            dfs(to,x);
            low[x]=min(low[x],low[to]);
        }
        else if(ins[to])
        {
            low[x]=min(low[x],dfn[to]);
        }
    }
    if(dfn[x]==low[x])
    {
        cnt3++;
        do
        {
            bl[s[top]]=cnt3;
            ins[s[top]]=0;
        }while(s[top--]!=x);
    }
}

原题P1407稳定婚姻

ans=1e9+7
next max min map x1 y1 pipe 等,