#define _crt_secure_no_warnings#include#include
#include
#include
#include
#include
using
namespace
std;
#define rep(i,t,n) for(int i =(t);i<=(n);++i)
#define per(i,n,t) for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
#define ls(n) node[n].ch[0]
#define rs(n) node[n].ch[1]
const
int n = 100010
;const
int inf = 0x3f3f3f3f
;struct
splay
}node[n];
introot;
//維護乙個結點
void pushup(int
n)
//標記向下傳
void pushdown(int
n)
if(rs(n))
node[n].add = 0
; }
if(node[n].flip)
}//旋轉
void rotate(int n, int
d)
//將結點n轉到goal下
void splay(int n, int
goal)
}pushup(n);
if (goal == 0) root =n;
}//找尋中序遍歷中的第pos個結點
intselect(int
pos)
pushdown(u);
}return
u; }
//查詢l~r最大值
int query(int l, int
r)
//給l~r加上val
void update(int l, int r, int
val)
//翻轉l~r
void reverse(int l, int
r)
//類似二分來建樹,就是這段**現在的我還不會用指標來替換
int build(int l, int
r)
//初始化
void init(int
n)
}splay_tree;
intmain()
if (opt == 2
) splay_tree.reverse(l, r);
if (opt == 3) printf("
%d\n
", splay_tree.query(l, r));
}return0;
}/*const int maxn = 55;
const int inf = 1e9 + 5;
ll n,m;
struct splay_tree
}t[maxn];
int fa[maxn], root;
void rotate(int x, int kind)
void splay(int x,)
};string s[maxn];
mapmmp;
int main()
else if (a == 2)
else
}return 0;
}*/
splay模板複習
splay模板 記得加哨兵!include using namespace std pre def const double pi acos 1.0 const int inf 0x3f3f3f3f typedef long long ll typedef unsigned long long ul...
dinic 模板 待補充
include using namespace std define mk make pair define pus push back define mo 1005 vector d mo vector de mo int tag mo int dfs int node,int low,int n...
splay模板基本操作
splay模板指標實現 splay中序遍歷維護原序列下標的順序,翻轉後這個順序會改變,但是splay中第x個數代表變換後序列中第x個數 這樣就可以直接查詢變換後的序列 重在 文藝平衡樹 include include include include define inf 0x3f3f3f3f usi...