37分fhq-treap求调

P3369 【模板】普通平衡树

%%%
by Igallta @ 2024-01-18 09:13:17


似乎kth错了,但哪里错了呢?
by Enoch006 @ 2024-01-18 09:47:35


%%%
by yuhaoyang09 @ 2024-01-18 09:49:35


糟了不会while怎么办,while里面没有!wssb
by Enoch006 @ 2024-01-18 09:50:40


@[Enoch006](/user/538683) 提供一个没有while的kth ```cpp int gr(int p,int k){ if(a[a[p].l].siz+1==k) return p; if(k<=a[a[p].l].siz) return gr(a[p].l,k); return gr(a[p].r,k-(a[a[p].l].siz+1)); } ```
by D_C_Z @ 2024-01-18 14:27:34


递归 is more fun
by D_C_Z @ 2024-01-18 14:28:16


@[D_C_Z](/user/652972) 非常的感谢只是我心血来潮不想写递归qwq
by Enoch006 @ 2024-01-18 14:31:31


|