上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页
摘要: 树链剖分的实质:将一棵树划分成若干条链,用数据结构去维护每条链。 如:把边或点哈希到线段树(或其他数据结构)上进行维护和查询。 这样做的理由:从根到某一点的路径上,不超过logn条轻边和不超过logn条重路径。 下面开始介绍树链剖分的做法: size(u)为以u为根的子树节点个数(包括u),令v为u 阅读全文
posted @ 2017-05-17 20:38 weeping 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 伪素数: 如果存在和n互素的正整数a满足a^(n-1)≡1(mod n),则n是基于a的伪素数。 是伪素数但不是素数的个数是非常非常少的,所以如果一个数是伪素数,那么他几乎是素数。 Miller_Rabbin素数测试:随机选k个a进行a^(n-1)≡1(mod n)测试,如果都满足则判断n是素数。 阅读全文
posted @ 2017-05-16 12:45 weeping 阅读(277) 评论(0) 推荐(0) 编辑
摘要: lca倍增模板: 阅读全文
posted @ 2017-05-15 17:22 weeping 阅读(227) 评论(0) 推荐(0) 编辑
摘要: update-2018.07.23: 原文问题五思路描述有误,已更正。 参考自:《数据结构漫谈》-许昊然 dfs序是树在dfs先序遍历时的序列,将树形结构转化成序列问题处理。 dfs有一个很好的性质:一棵子树所在的位置处于一个连续区间中。 ps:deep[x]为x的深度,l[x]为dfs序中x的位置 阅读全文
posted @ 2017-05-12 20:21 weeping 阅读(4520) 评论(6) 推荐(4) 编辑
摘要: 单点更新,区间查询 区间增减,单点查询 区间增减,区间查询 二维树状数组:单点修改,区间查询 二维树状数组:区间修改,单点查询 阅读全文
posted @ 2017-05-11 01:44 weeping 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/807/problem/D 题目: D. Dynamic Problem Scoring time limit per test 2 seconds memory limit per test 256 megabytes input 阅读全文
posted @ 2017-05-08 13:53 weeping 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/807/problem/C 题目: C. Success Rate time limit per test 2 seconds memory limit per test 256 megabytes input standard in 阅读全文
posted @ 2017-05-08 13:37 weeping 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3965 题目: iven two depth-first-search (DFS) sequences of a binary tree, can you find a 阅读全文
posted @ 2017-04-27 22:07 weeping 阅读(754) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962 题目: A seven segment display, or seven segment indicator, is a form of electronic 阅读全文
posted @ 2017-04-25 22:12 weeping 阅读(663) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3961 题目: ACM (ACMers' Chatting Messenger) is a famous instant messaging software devel 阅读全文
posted @ 2017-04-25 22:03 weeping 阅读(380) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3960 题目: Japari Park is a large zoo home to extant species, endangered species, extinc 阅读全文
posted @ 2017-04-25 22:01 weeping 阅读(511) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959 题目: It's time to prepare the problems for the 14th Zhejiang Provincial Collegiate 阅读全文
posted @ 2017-04-25 21:41 weeping 阅读(508) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3958 题目: "Miss Kobayashi's Dragon Maid" is a Japanese manga series written and illustr 阅读全文
posted @ 2017-04-25 21:38 weeping 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 题目: Problem Statement Operation L: Each element is increased by the value of its left neighbor. Operation R: Each element is increased by the value of 阅读全文
posted @ 2017-04-20 16:03 weeping 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/801/problem/D 题目: D. Volatile Kite time limit per test 2 seconds memory limit per test 256 megabytes input standard i 阅读全文
posted @ 2017-04-20 15:30 weeping 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/801/problem/C 题目: C. Voltage Keepsake time limit per test 2 seconds memory limit per test 256 megabytes input standar 阅读全文
posted @ 2017-04-20 15:09 weeping 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/796/problem/D 题目: D. Police Stations time limit per test 2 seconds memory limit per test 256 megabytes input standard 阅读全文
posted @ 2017-04-11 13:58 weeping 阅读(372) 评论(0) 推荐(0) 编辑
摘要: 地址:http://codeforces.com/contest/796/problem/C 题目: C. Bank Hacking time limit per test 2 seconds memory limit per test 256 megabytes input standard in 阅读全文
posted @ 2017-04-11 12:37 weeping 阅读(359) 评论(0) 推荐(0) 编辑
摘要: 1.把所需对拍的代码的可执行文件a.exe b.exe放在同一目录下 2.把rand数据的代码的可执行文件c.exe放在该目录下 3.新建一个txt文件,里面添加代码,后把格式改成bat 代码简单介绍: 1):loop类似c语言里面的标志,用于跳转(也就是循环). 2):第三行代码:先生成数据到da 阅读全文
posted @ 2017-04-09 04:17 weeping 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 1 int phi[5*K]; 2 void init(int k) 3 { 4 phi[1]=1; 5 for(int i=2;i1) 22 ans=ans*x/(x-1); 23 return ans; 24 } 阅读全文
posted @ 2017-04-06 21:38 weeping 阅读(136) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 16 下一页