正文
增加 6 行删除 6 行
69 行未改动70717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011127 行未改动69 行未改动root=tre[root][1];}else{if(!tre[root][0]){tre[root][0]=++tot;G[i].push_back(tre[root][0]);}root=tre[root][0];}}fro[root]=x;}IL void dfs(ll lc,ll rc){// printf("now at %lld and %lld\n",lc,rc);if(!tre[lc][0]&&!tre[lc][1]){//我们取最小的一条边连通minn=min(minn,sum[fro[lc]]^sum[fro[rc]]);return;}if(tre[lc][0]){//01Trie树上的贪心if(tre[rc][0]) dfs(tre[lc][0],tre[rc][0]);else dfs(tre[lc][0],tre[rc][1]);}if(tre[lc][1]){if(tre[rc][1]) dfs(tre[lc][1],tre[rc][1]);else dfs(tre[lc][1],tre[rc][0]);}}IL void getans(ll now){minn=999999999999999LL;dfs(tre[now][0],tre[now][1]);ans+=minn;// dfs(tre[now][1],tre[now][0]);}27 行未改动69 行未改动70717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011127 行未改动69 行未改动root=tre[root][1];}else{if(!tre[root][0]){tre[root][0]=++tot;G[i].push_back(tre[root][0]);}root=tre[root][0];}}fro[root]=x;}IL void dfs(ll lc,ll rc){// printf("now at %lld and %lld\n",lc,rc);if(!tre[lc][0]&&!tre[lc][1]){//我们取最小的一条边连通minn=min(minn,sum[fro[lc]]^sum[fro[rc]]);return;}if(tre[lc][0]){//01Trie树上的贪心if(tre[rc][0]) dfs(tre[lc][0],tre[rc][0]);else dfs(tre[lc][0],tre[rc][1]);}if(tre[lc][1]){if(tre[rc][1]) dfs(tre[lc][1],tre[rc][1]);else dfs(tre[lc][1],tre[rc][0]);}}IL void getans(ll now){minn=999999999999999LL;dfs(tre[now][0],tre[now][1]);ans+=minn;// dfs(tre[now][1],tre[now][0]);}27 行未改动