
数据结构
文章平均质量分 87
我的指针和我一样已找到对象
退役的ACMer。现在:智能媒体计算、大数据
展开
-
hdu1512 & zoj2334Monkey King (左偏树 + 并查集(非优化的朴素并查集))
在一个森林里住着N(N在一开始,他们是互不认识的。但是随着时间的推移,猴子们少不了争斗,但那只会发生在互不认识(认识具有传递性)的两群猴子之间(可能只有他们自己)。争斗时,两群猴子都会请出他们里面最强壮的一只(有可能是他自己)进行争斗。争斗后,这两群猴子就互相认识。 每个猴子有一个强壮值,但是被请出来的那两只猴子进行争斗后,他们的强壮值都会减半(例如10会减为5,5会减为2)。原创 2015-07-28 21:30:59 · 861 阅读 · 0 评论 -
CF305 Mike and Feet 单调栈(求每个长度对应的最小数字)
题目链接:http://codeforces.com/contest/548/problem/DD. Mike and Feettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutput原创 2015-06-09 16:54:10 · 501 阅读 · 0 评论 -
Inversion Sequence 已知逆序数(前面比它大的数的个数),还原数组
一个很经典的题目,HNU OJ 的链接是 http://acm.hnu.cn/online/?action=problem&type=show&id=13274 点击打开链接CF上面似乎也有这一题,没专门去找Inversion SequenceTime Limit: 2000ms, Special Time Limit:5000ms,Memor原创 2015-04-04 20:21:21 · 969 阅读 · 0 评论 -
拓扑排序 uva10305
/*#include#include#include#include#include#include#include#include#include#include#include#define LL long long#define INF 0x3f3f3f3fusing namespace std;const int N=1000000009;int G[105]转载 2015-03-08 15:45:39 · 377 阅读 · 0 评论 -
一行盒子,数组表示链表
#includeint Left[100005],Right[100005];void link(int L,int R){ Right[L]=R;Left[R]=L;}int main(){ int n,m,cas=0; while(scanf("%d%d",&n,&m)==2){ for(int i=1;i<=n;i++){ Left[i]=i-1; Right[翻译 2015-03-06 21:16:47 · 378 阅读 · 0 评论 -
二叉树层次遍历,VUA122
Trees on the levelhttp://www.bnuoj.com/v3/problem_show.php?pid=17261(11,LL) (7,LLL) (8,R)(5,) (4,L) (13,RL) (2,LLR) (1,RRR) (4,RR) ()(3,L) (4,R) ()Sample Output5 4原创 2015-02-21 13:35:34 · 387 阅读 · 0 评论