字典树(Trie)模板(于是他错误的点名开始了)


字典树(Trie)模板(于是他错误的点名开始了)

原题目:

P2580 于是他错误的点名开始了 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)

#include
using namespace std;
const int maxn=1e6+7,maxm=1e5+7;
const int N=maxn,charset=26;
int n,m;
struct Trie{
    int tot,root,nex[N][charset],flag[N];
    Trie(){
        memset(nex,-1,sizeof(nex));
        memset(flag,0,sizeof(flag));
        root = tot = 0;
    }
    void clear(){
        memset(nex,-1,sizeof(nex));
        memset(flag,0,sizeof(flag));
        root = tot = 0;
    }
    void insert(string s){
        int now=root;
        for(int i=0;i>n;
    for(int i=0;i>s;
        T.insert(s);
    }
    cin>>m;
    for(int i=0;i>s;
        int temp=T.query(s);
        if(temp==0){
            cout<<"WRONG"<