//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-5.1二分",
        "body": [
            "// luogu-judger-enable-o2",
            "#include<bits/stdc++.h>",
            "using namespace std;",
            "int pan[100010],b[100010],f[100010],n,i,a,len=1,l,r,mid;",
            "inline int in(){",
            "    int x=0,fh=1;char c=getchar();",
            "    while(c<'0'||c>'9')c=getchar();",
            "    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();",
            "    return x*fh;",
            "}",
            "int main(){",
            "    n=in();",
            "    for(i=1;i<=n;i++)a=in(),pan[a]=i,f[i]=0xfffffff;",
            "    for(i=1;i<=n;i++)a=in(),b[i]=pan[a];",
            "    for(i=1;i<=n;i++)printf(\"%d \",b[i]);puts(\"\");",
            "    f[1]=b[1];",
            "    for(i=2;i<=n;i++){",
            "    \tl=0;r=len;",
            "    \tif(b[i]>f[len])f[++len]=b[i];",
            "    \telse{",
            "    \t\twhile(l<r){",
            "    \t\t\tmid=(l+r)/2;",
            "    \t\t\tif(f[mid]<b[i])l=mid+1;",
            "    \t\t\telse r=mid;",
            "    \t\t}",
            "    \t\tf[l]=min(b[i],f[l]);",
            "    \t}",
            "    }",
            "    for(i=1;i<=n;i++)printf(\"%d \",f[i]);puts(\"\");",
            "    printf(\"%d\",len);",
            "    return 0;",
            "}",
            ""
        ],
        "description": "插入 最长公共子序列"
    }
}