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
题目大意:给定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
转载 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
定义: 结构是用户自定义的值类型代码样式:struct Pair{ public int X, Y; //公有变量名单词的首字母大写(PascalCase规则)}struct Pair{ private int x, y; //非公有变量名第一个单词的首字母小写(camelCase规则)}struc...
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
- 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
Hacker rank真的比leetcode 难了不止一个等级。。
这题有点巧妙。。深度搜索每条路径,然后枚举,基本很多人都想的出来,但是关键在于这样肯定超时。巧妙之处在于要给每条路径建立一个线段树来加速查询,每次similar查询复杂度从O(h)变成O(lgh)。。
犯了两个错误
(1)要用long来存储线段树,已经可能的similar pairs。
(2)值减去T可能...
分类:
其他好文 时间:
2015-01-18 07:07:00
阅读次数:
412
题目中说每一个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
mismatch原型:std::mismatchequality (1)template pair mismatch (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);pred...
分类:
编程语言 时间:
2015-01-17 11:08:42
阅读次数:
143
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