萌新想知道两种函数写法为什么只有第一个AC了
查看原帖
萌新想知道两种函数写法为什么只有第一个AC了
1498958
Tao_ran_ju楼主2025/1/27 19:13

int find(int x){ if(x==p[x])return x; return p[x]=find(p[x]); }

//↑第一种是我在题解看到的写法,AC了

int find(int x){ if(x!=p[x])return find(p[x]); return p[x]; }

//↑第二种是acwing上y总教的,但是TLE了

2025/1/27 19:13
加载中...