码迷,mamicode.com
首页 >  
搜索关键字:pair    ( 2800个结果
373. Find K Pairs with Smallest Sums (java,优先队列)
题目: You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element fro ...
分类:编程语言   时间:2016-08-12 13:33:21    阅读次数:225
HDU 5818 Joint Stacks(左偏树)
题目链接:点击打开链接 思路: 该题的关键是怎么把两个栈合并, 我们可以使用一种叫左偏树的数据结构, 满足堆的性质和集合的性质,支持在O(logn)的复杂度下进行删除堆顶元素, 插入一个元素,合并两个堆。 细节参见代码: #include using namespace std; typedef pair P; const int maxn = 152400; P v[maxn]; in...
分类:其他好文   时间:2016-08-10 21:10:37    阅读次数:147
LCA模板
代码 typedef pair<int,int> par; struct LCA { int id,ver[maxn*2],deep[maxn*2];//id先序访问编号,ver保存id对应节点编号,deep深度 int disc[maxn],fa[maxn]; //disc点被访问时的id,fa父 ...
分类:其他好文   时间:2016-08-09 22:06:35    阅读次数:250
IOS自定义NSDictionary键值类
使用OC自定义了一个IntPair类作为NSDictionary类的键值,与JAVA中的Pair<int,int>使用方式类似,然而在使用过程中遇到了各种问题,有必要记录一下。 首先,需要实现NSCoping协议,如果不实现的话,在使用IntPair作为key向dictionary中添加数据时会报警 ...
分类:移动开发   时间:2016-08-09 18:48:39    阅读次数:587
SPOJ DQUERY - D-query
DQUERY - D-query Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). For each d-query ...
分类:其他好文   时间:2016-08-06 11:28:15    阅读次数:156
HDU 5791 Two
Description Alice gets two sequences A and B. A easy problem comes. How many pair of sequence A' and sequence B' are same. For example, {1,2} and {1,2 ...
分类:其他好文   时间:2016-08-05 00:53:43    阅读次数:170
HDU 5791 Two DP
Two Problem Description Alice gets two sequences A and B. A easy problem comes. How many pair of sequence A' and sequence B' are same. For example, {1 ...
分类:其他好文   时间:2016-08-03 20:21:19    阅读次数:182
HDU 5791:Two(DP)
http://acm.hdu.edu.cn/showproblem.php?pid=5791 Two Problem Description Alice gets two sequences A and B. A easy problem comes. How many pair of sequen ...
分类:其他好文   时间:2016-08-03 11:45:08    阅读次数:254
Largest Divisible Subset
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or ...
分类:其他好文   时间:2016-08-02 11:34:21    阅读次数:110
HDU 5780 gcd
不会...看了题解这个公式就简单了:gcd(x^a-1,x^b-1)=x^gcd(a,b)-1。 那么只要枚举一下d,[1,n]内 gcd(a,b)=d的有几对,对答案做出的贡献为 pair[d]*(x^d-1)。 pair[d]容易计算:即[1,n/d]内 gcd(a,b)=1的有几对,那么就是2 ...
分类:其他好文   时间:2016-08-01 11:52:38    阅读次数:147
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!