//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 的格式要求是 "插入 [该代码片段的中文名]"

{
    "字符串Hash表": {
        "prefix": "acm-6.4兔子与兔子",
        "body": [
            "#include<iostream>",
            "#include<string>",
            "#include<cstdio>",
            "#define LL long long",
            "using namespace std;",
            "const int N=1e6+5;",
            "int l1,r1,l2,r2,n,m,i,p=27;",
            "LL f[N],mi[N];string a;",
            "inline LL Hash(int l,int r){return f[r]-f[l-1]*mi[r-l+1];}",
            "int main(){",
            "    cin>>a;n=a.size();a='$'+a;mi[0]=1;",
            "    for(i=1;i<=n;i++)f[i]=f[i-1]*p+a[i]-'a'+1,mi[i]=mi[i-1]*p;",
            "    scanf(\"%d\",&m);",
            "    while(m--){",
            "        scanf(\"%d%d%d%d\",&l1,&r1,&l2,&r2);",
            "        if(Hash(l1,r1)==Hash(l2,r2))printf(\"Yes\\n\");",
            "        else printf(\"No\\n\");",
            "    }",
            "}",
            ""
        ],
        "description": "插入 字符串Hash表"
    }
}