我的Trie,它死(本机RE)了

P2922 [USACO08DEC] Secret Message G

RT,在样例输入第三行的时候RE 求dalao debug......
by Jelly_Goat @ 2019-03-20 18:49:58


大佬真人%%%
by 小蒟蒻皮皮鱼 @ 2019-06-14 09:47:14


@[Jelly_Goat](/space/show?uid=122927) 给你个板子 ```cpp template<int set_,int mod> struct trie{ struct node{ node* son[set_]; int flag; }; node* root,*ctrl_c;//复制一下后面迭代查找有用 inline void init(){ clear(ctrl_c); root=new node(),ctrl_c=root; } inline void insert(string line){ root=ctrl_c; for(int i=0;i<line.length();i++){ if(root->son[line[i]%mod]==NULL){ root->son[line[i]%mod]=new node(),root->son[line[i]%mod]->flag=0; } root=root->son[line[i]%mod]; } root->flag++,root=ctrl_c; } inline int count(string line){ root=ctrl_c; for(int i=0;i<line.length();i++){ if(root->son[line[i]%mod]==NULL){ root=ctrl_c; return 0; } root=root->son[line[i]%mod]; } return root->flag; } inline void del(string line){ root=ctrl_c; for(int i=0;i<line.length();i++){ if(root->son[line[i]%mod]==NULL){ root=ctrl_c; return; } root=root->son[line[i]%mod]; } root->flag=(root->flag==0?0:root->flag-1); root=ctrl_c; } void clear(node* now){ if(now==NULL) return; for(int i=0;i<set_;i++) if(now->son[i]!=NULL) clear(now->son[i]); delete now; } }; ```
by qbu666666 @ 2019-08-27 11:44:36


@[qbu666666](/space/show?uid=157598) ~~我会告诉你现在我AC了吗~~ 谢谢你的板子QwQ
by Jelly_Goat @ 2019-08-27 20:15:27


@[Jelly_Goat](/space/show?uid=122927) ~~我能说我在给你板子之前差点想考古吗~~
by qbu666666 @ 2019-08-28 00:09:21


@[qbu666666](/space/show?uid=157598) ~~烤咕~~
by Jelly_Goat @ 2019-08-28 19:28:17


千古神犇高赤赤,吊打清华$zhx$,日均$270$,场均$rank1$,爆踩集训队,$AKIOI$
by ZORO @ 2019-11-06 09:59:31


|