版本比较
无旋 Treap
正文
增加 8 行删除 8 行
4 行未改动56789101112131415161718113 行未改动全部展开1321331341351361371381391401411421431441453 行未改动14915015115215315415515615733 行未改动19119219319419519619719819920020120220383 行未改动4 行未改动```cpp#include<bits/stdc++.h>using namespace std;#define pair pair<int,int>#define mkpair make_pair#define ls(x) (son[x][0])#define rs(x) (son[x][1])const int N=1e6+1e5+5;int val[N],wei[N];int son[N][2];int sz[N];int tot,root;void pushup(int x){113 行未改动全部展开```cpp#include<bits/stdc++.h>using namespace std;#define pair pair<int,int>#define mkpair make_pair#define ls(x) (son[x][0])#define rs(x) (son[x][1])const int N=1e6+1e5+5;int val[N],wei[N];int son[N][2];int sz[N];int tot,root;int tag[N];3 行未改动if(rs(x))tag[rs(x)]^=1;swap(ls(x),rs(x));tag[x]=0;}}void pushup(int x){sz[x]=1+sz[ls(x)]+sz[rs(x)];}pair split(int x,int k){33 行未改动pair t=split(root,k);root=merge(merge(t.first,tot),t.second);}void print(int x){pushdown(x);if(ls(x))print(ls(x));cout<<x<<" ";if(rs(x))print(rs(x));}void setrand(){srand(time(0));srand(rand());}83 行未改动4 行未改动56789101112131415161718113 行未改动全部展开1321331341351361371381391401411421431441453 行未改动14915015115215315415515615733 行未改动19119219319419519619719819920020120220383 行未改动4 行未改动```cpp#include<bits/stdc++.h>using namespace std;#define pair pair<int,int>#define mkpair make_pair#define ls(x) (son[x][0])#define rs(x) (son[x][1])const int N=1e6+1e5+5;int val[N],wei[N];int son[N][2];int sz[N];int tot,root;void pushup(int x){113 行未改动全部展开```cpp#include<bits/stdc++.h>using namespace std;#define pair pair<int,int>#define mkpair make_pair#define ls(x) (son[x][0])#define rs(x) (son[x][1])const int N=1e6+1e5+5;int val[N],wei[N];int son[N][2];int sz[N];int tot,root;int tag[N];3 行未改动if(rs(x))tag[rs(x)]^=1;swap(ls(x),rs(x));tag[x]=0;}}void pushup(int x){sz[x]=1+sz[ls(x)]+sz[rs(x)];}pair split(int x,int k){33 行未改动pair t=split(root,k);root=merge(merge(t.first,tot),t.second);}void print(int x){pushdown(x);if(ls(x))print(ls(x));cout<<x<<" ";if(rs(x))print(rs(x));}void setrand(){srand(time(0));srand(rand());}83 行未改动