HDU 4584 splay】的更多相关文章

Shaolin Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 3021    Accepted Submission(s): 1273 Problem Description Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaol…
Queue-jumpers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3139    Accepted Submission(s): 848 Problem Description Ponyo and Garfield are waiting outside the box-office for their favorite mo…
Looploop Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1651    Accepted Submission(s): 517 Problem Description XXX gets a new toy named Looploop. The toy has N elements arranged in a loop, an…
给定两种操作,一种是把一个数列的某一段切下来插到剩余数列的某一个位置上. 一种是翻转操作,把数列的某一段进行翻转. 都是Splay的基本操作.标准的Rotateto调整出 [a,b]区间.然后对[a,b]区间修改parent标记和child标记.然后记住PushUp把修改标记推到树根上.简单一点就直接对某个节点spaly(x,0)就OK! 1: #include <cstdio> 2: #include <iostream> 3: #include <vector> 4…
Robotic Sort Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3340    Accepted Submission(s): 1423 Problem Description Somewhere deep in the Czech Technical University buildings, there are labor…
Play with Chain Time Limit: 6000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6779    Accepted Submission(s): 2678 Problem Description YaoYao is fond of playing his chains. He has a chain containing n diamond…
题意:与区间查询点更新,点有20W个,询问区间的最大值.曾经用线段树,1000+ms,今天的伸展树,890没ms,差不多. 第一次学习伸展树,一共花了2个单位时间,感觉伸展树真很有用,也很好玩.现在只学了一点点.切个点更新试试. 大致思路:用编号(数组)作为树的键值建树,每插一个数,沿路节点更新最大值(每个结点有一个附加信息标记以之为子树的树所有点的最大值).所以,查询时[i,j],只要把i-1伸展到树根,把j+1伸展到I-1下面,那么j+1的左子树就是要的区间了!查该子树根值信息即可(特判端点…
#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 1000000007 const int INF=0x3f3f3f3f; ; typedef long long ll;…
Building bridges Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 45    Accepted Submission(s): 39 Problem Description Hululu and Cululu are two pacific ocean countries made up of many islands. T…
//也是简单题,因为n太小,故暴力之! #include<stdio.h> #include<math.h> #include<string.h> #define max 45 char map[max][max]; int dis(int x1,int y1,int x2,int y2){ return fabs(x1-x2*1.0)+fabs(y1-y2*1.0); } int main(){ int n,m; while(~scanf("%d%d&quo…