摘要:
splay第一题,有了Treap的基础以后感觉splay还是比较好理解的,splay的优势在于编程复杂度比较低且效率不错,通过splay操作以及衍生的split和merge操作可以实现很强大的功能。 1 #include 2 #include 3 #include 4 using na... 阅读全文
posted @ 2015-08-24 20:18
hxy_has_been_used
阅读(161)
评论(0)
推荐(0)
摘要:
理解清楚题意以后就明白为什么要用并查集了。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 100001; 7 int f[N]; 8 int ans; 9 10 void init()11 ... 阅读全文
posted @ 2015-08-24 10:31
hxy_has_been_used
阅读(211)
评论(0)
推荐(0)
摘要:
用优先队列模拟一下就ok啦。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N = 3001; 8 int mp[N]; 9 10 struct Node 11 {12 ... 阅读全文
posted @ 2015-08-24 09:45
hxy_has_been_used
阅读(178)
评论(0)
推荐(0)
摘要:
比较基础的带权并查集,需要注意终止条件是'O'而不是'0'... 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int N = 20001; 8 const int MOD = 10... 阅读全文
posted @ 2015-08-24 09:06
hxy_has_been_used
阅读(156)
评论(0)
推荐(0)