//Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and 
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
// same ids are connected.
// prefix 的格式要求是 acm-[一级标题编号].[二级标题编号][该代码片段的英文简称]
// description 的格式要求是 "插入 [该代码片段的中文名]"

{
    "欧拉路,欧拉回路": {
        "prefix": "acm-3.3骑马修栅栏",
        "body": [
            "#include<algorithm>",
            "#include<cstdio>",
            "#define Re register int",
            "using namespace std;",
            "const int N=1030;",
            "int n,x,y,mi=2e9,st=2e9,as,du[N],ans[N],r[N][N];",
            "inline void in(Re &x){",
            "\tRe fu=0;x=0;char ch=getchar();",
            "\twhile(ch<'0'||ch>'9')fu|=ch=='-',ch=getchar();",
            "\twhile(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();",
            "\tx=fu?-x:x;",
            "}",
            "inline void dfs(Re x){",
            "\tfor(Re i=1;i<=500;++i)",
            "\t\tif(r[x][i]){",
            "\t\t\t--r[x][i],--r[i][x];",
            "\t\t\tdfs(i);",
            "\t\t}",
            "\tans[++as]=x;",
            "}",
            "int main(){",
            "\tin(n);",
            "\tfor(Re i=1;i<=n;++i)in(x),in(y),++r[x][y],++r[y][x],++du[x],++du[y],mi=min(mi,min(x,y));",
            "\tfor(Re i=1;i<=500;++i)if(du[i]&1)st=min(st,i);",
            "\tif(st==2e9)st=mi;",
            "\tdfs(st);",
            "\tfor(Re i=as;i;--i)printf(\"%d\\n\",ans[i]);",
            "}",
            ""
        ],
        "description": "插入 欧拉路,欧拉回路"
    }
}