码迷,mamicode.com
首页 >  
搜索关键字:veth pair    ( 2862个结果
[topcoder]TheGridDivTwo
http://community.topcoder.com/stat?c=problem_statement&pm=13628&rd=16278标程是BFS,我用DFS,都可解。这里复杂的把pair写了hash函数,其实直接用个矩阵来存bool就可以了。#include #include #incl...
分类:其他好文   时间:2015-01-24 00:28:13    阅读次数:126
UVa 439 Knight Moves(BFS应用)
题意  求国际象棋中骑士从一个位置移东到另一个位置所需最少步数 基础的BFS应用 #include using namespace std; int x[] = { -2, -1, -2, -1, 1, 2, 1, 2}; int y[] = { -1, -2, 1, 2, -2, -1, 2, 1}; int d[15][15], sx, sy, ex, ey; pair q[105], ...
分类:其他好文   时间:2015-01-23 20:13:47    阅读次数:209
Dijkstra[两种邻接表+优先队列优化]
Dijksta算法中,如果我们采用的是邻接矩阵来存的,第一点浪费的空间比较多,第二点我们知道算法的时间复杂度在O(n*n),这样的算法可以说并不是很好,所以我们考虑优化它首先我们可以优化存储结构,采用邻接表来存储,其次我们可以用优先队列来排序大小,其时间复杂度大大降低。 需要注意的是pair是按照第一个元素的大小排序,如果相同才按照第二个,所以我们要把d[i]包装在第一个元素上。 vect...
分类:其他好文   时间:2015-01-22 18:23:48    阅读次数:150
【分治法】在数组A中,返回i<j,且A[i]>A[j]的(i,j)配对的数量
题目:EPI 在本题中,把数组分成左右两部分,分别计算左右两部分的invrted pair的数量,再计算A[i] 和 A[j]一边一个的情况,然后把三者相加。 int count_invert_core(vector &arr,int begin,int end) { if (end - begin + 1 < 2) return 0; if (end - begin + 1 ...
分类:编程语言   时间:2015-01-22 09:36:34    阅读次数:189
Codility MaxAbsSliceSum Solution
1.题目(HARD)A non-empty zero-indexed array A of N integers is given. A pair of integers (P, Q), such that 0 ≤ P ≤ Q < N, is called asliceof array A. The...
分类:其他好文   时间:2015-01-22 01:38:03    阅读次数:1345
BZOJ 3239 Discrete Logging Baby-Step-Giant-Step
题目大意:给定P,B,N,求最小的L使B^L≡N (mod P) (P是质数) 裸的BSGS。。。 练练手吧- - #include #include #include #include #include #define M 100100 #define INF 0x3f3f3f3f using namespace std; typedef pair abcd; long long ...
分类:其他好文   时间:2015-01-20 12:07:39    阅读次数:204
【HADR】How to reestablish HADR from scratch after a failure on Standby
转载 http://www-01.ibm.com/support/docview.wss?uid=swg21514783 Cause Have a HADR pair with Primary online but a failure on the Standby makes it necessar...
分类:数据库   时间:2015-01-19 20:51:42    阅读次数:223
C#中结构体的声明
定义: 结构是用户自定义的值类型代码样式:struct Pair{ public int X, Y; //公有变量名单词的首字母大写(PascalCase规则)}struct Pair{ private int x, y; //非公有变量名第一个单词的首字母小写(camelCase规则)}struc...
分类:Windows程序   时间:2015-01-19 14:14:05    阅读次数:170
average slice
A non-empty zero-indexed array A consisting of N integers is given. A pair of integers (P, Q), such that 0 ≤ P < Q < N, is called a slice of array A (...
分类:其他好文   时间:2015-01-18 20:56:08    阅读次数:107
Careercup\Mitbbs
- G: a vector of strings, find a pair with max of strlen(a) * strlen(b) 1. O(n*k): get std::bitset() of each string 2. O(nlgn): sort strings by leng.....
分类:其他好文   时间:2015-01-18 11:48:41    阅读次数:168
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!