码迷,mamicode.com
首页 >  
搜索关键字:veth pair    ( 2862个结果
Similar Pair _ HackerRank
Hacker rank真的比leetcode 难了不止一个等级。。 这题有点巧妙。。深度搜索每条路径,然后枚举,基本很多人都想的出来,但是关键在于这样肯定超时。巧妙之处在于要给每条路径建立一个线段树来加速查询,每次similar查询复杂度从O(h)变成O(lgh)。。 犯了两个错误 (1)要用long来存储线段树,已经可能的similar pairs。  (2)值减去T可能...
分类:其他好文   时间:2015-01-18 07:07:00    阅读次数:412
498C - Array and Operations 质因子分解+最大流
题目中说每一个good pair 都满足(u+v)%2 == 1,即一个奇数,一个偶数。 首先我们要拿出一原点S,汇点T,S联到所有的num[odd]的质因子上,T联到所有的num[even]的质因子上,边的流量为num[i]中相应质因子的个数。 再根据给出的,假设u为奇数,则从u的质因子上联到相等的v的质因子上,流量为INF。 丢到模板里跑一遍就好了。 #include #includ...
分类:其他好文   时间:2015-01-17 16:38:05    阅读次数:190
STL algorithm算法mismatch(37)
mismatch原型:std::mismatchequality (1)template pair mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);pred...
分类:编程语言   时间:2015-01-17 11:08:42    阅读次数:143
UVA1395 Slim Span(kruskal算法)
Slim Span [PDF Link] Given an undirected weighted graph G , you should find one of spanning trees specified as follows. The graph G is an ordered pair (V, E) , where V is a set of vertices {v1,...
分类:编程语言   时间:2015-01-12 22:37:21    阅读次数:391
a simple GC
先看这篇文章 http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/ 一个很小的GC,如何实现的呢?看一下源代码 #include #include #define STACK_MAX 256 typedef enum { OBJ_INT, OBJ_PAIR } Obj...
分类:其他好文   时间:2015-01-12 14:42:04    阅读次数:152
Java Notes-7
-One such related pair of patterns is the concept of an executor service that manages tasks and that of a thread pool that services tasks in an efficient way. -The new  Callable interface, whic...
分类:编程语言   时间:2015-01-09 00:18:47    阅读次数:365
C++基础之map按key排序
在项目当中有要用到map按key排序的需求,就在百度上搜了一下:typedef pair PAIR;int cmp(const PAIR& x, const PAIR& y){return x.second imgdis; //待排序对象,根据double值排序imgdis[1] = 3;imgd....
分类:编程语言   时间:2015-01-08 22:36:40    阅读次数:558
微软笔试题(苏州)
题目是  小明迷路了,求出他的方位,具体的题目没了,所以没有弄过来,希望大家海涵或者提供一下 #include #include #include using namespace std; int N; int M; char ** allmap; char ** side; int const side_length = 3; const pair error = make...
分类:其他好文   时间:2015-01-07 23:37:41    阅读次数:325
基于boost实现的共享内存版HashMap
#include #include #include #include #include int main (int argc, char *argv[]) { typedef int KeyType; typedef float MappedType; typedef std::pair ValueType; typedef boost::interp...
分类:其他好文   时间:2015-01-05 20:32:30    阅读次数:511
pair
这个是非常经典的树分治的题目,关于60分的做法.参见poj1741按照树分治的惯例,先全局统计,然后再减掉重复的东西.那么如何计算贡献呢?我们按照poj1741的方法.先将满足一维的情况的数据全部放入一个树状数组里面,然后我们就能够一维统计了.复杂度O(nlog2n)代码也比较凑合....#incl...
分类:其他好文   时间:2015-01-04 22:55:24    阅读次数:262
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!