警示后人(金丝猴人?)TLE

P8306 【模板】字典树

Daeyr_Xu @ 2024-11-20 17:33:49

如果你写的tire树十分板子却TLE了,看看tire树组初始化是不是用了memset(包超时的QAQ),应改为手动清0 如

memset(tree,0,sizeof(tree));
memset(cnt,0,sizeof(cnt));

改为

for(int i=0;i<=idx;i++)
    for(int j=0;j<=122;j++)
        tree[i][j]=0;
for(int i=0;i<=idx;i++) cnt[i]=0;
idx=0;

by blue_peace @ 2024-11-20 17:45:14

@Daeyr_Xu《tire》


by Daeyr_Xu @ 2024-11-20 18:57:01

@blue_peace emmm……打错了(汗颜


by Feny_233 @ 2024-11-26 16:02:29

%%%%%


by convie @ 2024-11-26 22:26:48

@Daeyr_Xu 谢谢你,金丝猴前辈^V^


by mincrafter_or_cy @ 2024-12-08 10:04:23

@Daeyr_Xu ty


|