题目链接食物链类似的题,主要是在于转化,a-b的和为s,转换为b比a-1大s。然后并查集存
此节点到根的差。假如x的根为a,y的根为b:b - y = rank[y]a - x = rank[x]y - x = s可以推出b - a = rank[y]
- rank[x] + s;并查集 延迟更新什...
分类:
其他好文 时间:
2014-05-09 18:38:05
阅读次数:
213
Popular Rice Recipe
Did you know that there are over 40,000 varieties of Rice in the world ? There are so many dishes that can be prepared with Rice too. A famous chef from Mumbai, Tid Gusto prep...
分类:
其他好文 时间:
2014-05-07 04:05:46
阅读次数:
428
http://acm.hdu.edu.cn/showproblem.php?pid=3038
这是一道并查集题目,这并查集感觉好难写,构思花了我很长很长时间,不过打码时间很短。考虑清楚之后明显快多了
#include
#include
#include
#include
#include
#include
#include
#define N 200010
using names...
分类:
其他好文 时间:
2014-05-07 04:03:06
阅读次数:
331
题目原文:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,Given n = 3, there are a total of 5 unique BST's.
题目理解...
分类:
其他好文 时间:
2014-05-06 22:15:57
阅读次数:
415
n! 末尾有多少个 0
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:travel the binary tree by level 5 ( from down to top and from left to right ever...
分类:
其他好文 时间:
2014-05-06 21:19:02
阅读次数:
554
there be意思:表示存在或者发生。英文释义:used to show that sth
exists or happens如果现在进行时,单数时用is,复数时用are。现在我问你一个问题.How many students in the class
room?你怎么回答呢?使用there be...
分类:
其他好文 时间:
2014-05-04 12:30:46
阅读次数:
304
HDU 3038 How Many Answers Are Wrong (带权并查集+区间判断)...
分类:
其他好文 时间:
2014-05-04 09:11:59
阅读次数:
301
So many days passed since the last C tutorial about the flowchart, this chapter we will go on the flowchart and while loops...
分类:
其他好文 时间:
2014-05-04 09:01:20
阅读次数:
307
题目链接:
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5176
Simple Equation
Time Limit: 2 Seconds Memory Limit: 65536 KB
There are many Equations. Some are difficu...
分类:
其他好文 时间:
2014-05-03 17:47:01
阅读次数:
343
Chef wrote some text on a piece of paper and now he wants to know how many holes are in the text. What is a hole? If you think of the paper as the plane and a letter as a curve on the plane, then each...
分类:
其他好文 时间:
2014-05-03 15:49:18
阅读次数:
412