自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(121)
  • 收藏
  • 关注

原创 进阶训练-动态规划

线性dp,背包问题,区间dp,树形dp,环形与后效性处理,状压dp,计数类dp,数位dp,倍增优化,数据结构优化,单调队列优化,斜率优化,四边形不等式线性dp>从集合角度考虑dp问题:状态表示集合属性(max,min,数量。。。)状态计算 —— 集合的划分重要划分依据:“最后一步”划分原则:不重不漏12...

2020-01-04 17:53:26 198

原创 由数据范围反推时间复杂度与算法

一般ACM或者笔试题的时间限制是1秒或2秒。在这种情况下,C++代码中的操作次数控制在 1e7 为最佳。下面给出在不同数据范围下,代码的时间复杂度和算法该如何选择:n≤30, 指数级别, dfs+剪枝,状态压缩dpn≤100 => O(n3),floyd,dpn≤1000 => O(n2),O(n2logn),...

2020-01-01 16:15:02 520

原创 线性基例题

最大异或和,第k小异或和最大异或和12345678910111213141516171819202122232425262728293031323334353637383940414243#include<bits/stdc++.h&g...

2019-08-13 13:24:01 170

原创 进阶训练-数论

质数,约数(反素数,除法分块),欧拉函数,同余(费马小,欧拉定理,欧拉降幂,exgcd,中国剩余定理,乘法逆元,线性同余方程,高次同余方程),矩阵快速幂,高斯消元,线性空间(生成子集,线性相关和线性无关,基底,矩阵的秩,线性基),组合数(二项式定理,多重集的排列数和组合数,卢卡斯定理,卡特兰数),容斥原理(多重集组合数),莫比乌斯函...

2019-08-12 19:19:30 366

原创 进阶练习-搜索

树与图的遍历,DFS,剪枝,迭代加深,BFS,双端队列BFS,优先队列BFS,A,K短路,IDA树与图的遍历DFS序:每个节点x的编号在序列中恰好出现两次。设这两次出现的位置为L[x]和R[x],那么闭区间[L[x],R[x]]就以x为根的子树的DFS序。树的重心,树的深度,图的连通块划分拓扑排序:拓扑排序可以判定有向图是否...

2019-08-10 20:01:26 168

原创 进阶训练-基本数据结构

单调栈,单调队列,双端队列,邻接表,Hash,字符串,trie单调栈借助单调性处理问题的思想在于及时排除不可能的选项,保证策略集合的高度有效性和秩序性,从而为我们做出的决策提供更多的条件和可能方法。例题:直方图的最大矩形面积单调队列同单调栈一样,也是在决策集合中及时排除一定不是最优解的选择,是优化动态规划的一个重要手段...

2019-08-10 16:48:22 92

原创 进阶训练-基本算法

位运算,递推与递归,前缀和与差分,二分,排序,倍增,贪心位运算移位运算快速幂,快速乘(1e18),状态压缩,成对变换,lowbit。12345678910//快速乘ll mul(ll a,ll b,ll p){ ll ans=0; while(b){ if(b&1) ...

2019-08-10 11:16:51 151

原创 luogu P2617——树状数组套主席树

传送门luogu P2617描述给定一个含有n个数的序列a[1],a[2],a[3]……a[n],程序必须回答这样的询问:对于给定的i,j,k,在a[i],a[i+1],a[i+2]……a[j]中第k小的数是多少(1≤k≤j-i+1),并且,你可以改变一些a[i]的值,改变后,程序还能针对改变后的a继续回答上面的问题。你需要编一个这...

2019-07-27 22:34:36 77

原创 Keen On Everything But Triangle——主席树

传送门HDU6601描述N sticks are arranged in a row, and their lengths are a1,a2,…,aN.There are Q querys. For i-th of them, you can only use sticks between li-th to ri-th. Plea...

2019-07-27 22:17:01 71

原创 Kth number———主席树模板

传送门HDU2665描述Give you a sequence and ask you the kth big number of a inteval.输入The first line is the number of the test cases.For each test case, the first line cont...

2019-07-27 21:38:38 99

原创 Picture(扫描线周长并)

传送门 HDU1828描述A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each r...

2019-07-24 19:30:44 179

原创 Farming(扫描线体积并)

传送门 HDU3255描述You have a big farm, and you want to grow vegetables in it. You’re too lazy to seed the seeds yourself, so you’ve hired n people to do the job for you.Eac...

2019-07-24 19:24:28 110

原创 Atlantis(扫描线面积并)

传送门 HDU1542描述There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the islan...

2019-07-24 18:57:15 205

原创 Nightmare2

传送门HDU3085描述Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are...

2019-07-14 16:58:11 233

原创 Travelling(三进制状压dp)

传送门HDU3001描述After coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the...

2019-07-14 16:21:30 119

原创 Gap

传送门HDU1067描述Let’s play a card game called Gap.You have 28 cards labeled with two-digit numbers. The first digit (from 1 to 4) represents the suit of the card, and the ...

2019-07-14 16:11:57 136

原创 Magic Cube

传送门ZOJ2477描述This is a very popular game for children. In this game, there’s a cube, which consists of 3 3 3 small cubes. We can unwrap the cube, it will become like ...

2019-07-14 14:20:17 127

原创 DNA Sequence(IDA*,迭代深搜)

传送门HDU1560描述The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from which DNA is built are A...

2019-07-14 14:15:17 139

原创 Escape

传送门HDU3533描述The students of the HEU are maneuvering for their military training.The red army and the blue army are at war today. The blue army finds that Little A is t...

2019-07-14 14:15:17 94

原创 Eight2

传送门HDU3567描述Eight-puzzle, which is also called “Nine grids”, comes from an old game.In this game, you are given a 3 by 3 board and 8 tiles. The tiles are numbered from...

2019-07-14 14:10:17 138

原创 Eight

传送门HDU1043描述The 15-puzzle has been around for over 100 years; even if you don’t know it by that name, you’ve seen it. It is constructed with 15 sliding tiles, each wit...

2019-07-14 14:06:17 76

原创 Find a way

传送门HDU2612描述Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good ...

2019-07-14 13:20:21 58

原创 非常可乐

传送门HDU1495描述大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好...

2019-07-14 13:11:13 126

原创 Fire

传送门UVA11624描述Joe works in a maze. Unfortunately, portions of the maze havecaught on fire, and the owner of the maze neglected to create a fireescape plan. Help Joe esc...

2019-07-14 13:01:04 67

原创 Fire Game(双起点BFS)

传送门FZU2150描述Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisti...

2019-07-14 12:50:14 101

原创 Pots

传送门POJ3414描述You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ...

2019-07-14 12:10:20 61

原创 Fliptile

传送门POJ3279描述Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they man...

2019-07-14 11:55:36 79

原创 Independent Task Scheduling

传送门SwustOj698描述用2 台处理机A 和B 处理n 个作业。设第i 个作业交给机器A 处理时需要时间ai ,若由机器B 来处理,则需要时间bi 。由于各作业的特点和机器的性能关系,很可能对于某些i,有ai >=bi,而对于某些j,j≠i,有aj < bj 。既不能将一个作业分开由2 台机器处理,也没有一台机器能...

2019-06-30 12:35:54 370 4

原创 Edit Distance

描述设A 和B 是2 个字符串。要用最少的字符操作将字符串A 转换为字符串B。这里所说的字符操作包括(1)删除一个字符;(2)插入一个字符;(3)将一个字符改为另一个字符。将字符串A变换为字符串B 所用的最少字符操作数称为字符串A到B 的编辑距离,记为d(A,B)。试设计一个有效算法,对任给的2 个字符串A和B,计算出它们的编辑距离...

2019-06-30 12:26:19 53

原创 Jack Straws —— 判断直线相交

传送门Poj1127描述In the game of Jack Straws, a number of plastic or wooden “straws” are dumped on the table and players try to remove them one-by-one without disturbing the...

2019-06-30 11:36:54 220

原创 Roadblocks——次短路

传送门POJ3255描述Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, bec...

2019-06-29 14:45:20 64

原创 Summer Holiday——Tarjan缩点

传送门HDU1827描述To see a World in a Grain of SandAnd a Heaven in a Wild Flower,Hold Infinity in the palm of your handAnd Eternity in an hour. —— William B...

2019-05-07 17:42:24 49

原创 迷宫城堡——Tarjan

传送门HDU1269描述为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是...

2019-05-07 17:06:36 86

原创 归并求逆序数

思路在归并排序的同时求逆序数区间[l,r]中,mid=(l+r)/2,i从l到mid,j从mid+1到r,当a[i]>a[j]的时候,a[i~mid]一定都大于a[j],因为单独看左右区间是已经排好序的,sum+=mid-i+1即可Code1234567891011121314151...

2019-05-03 18:31:57 66

原创 确定比赛名次——拓扑排序

传送门HDU1285描述有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。输入输入有...

2019-05-03 18:05:17 63

原创 最小圆覆盖

传送门HDU3007描述Each person had do something foolish along with his or her growth.But,when he or she did this that time,they could not predict that this thing is a mistake...

2019-05-03 17:42:51 63

原创 最近点对

传送门最近对问题题目描述设p1=(x1, y1), p2=(x2, y2), …, pn=(xn, yn)是平面上n个点构成的集合S,设计算法找出集合S中距离最近的点对。输入多组测试数据,第一行为测试数据组数n(0<n≤100),每组测试数据由两个部分构成,第一部分为一个点的个数m(0<m≤1000),紧接着是m行...

2019-04-27 00:12:23 110

原创 凸包

思路取最左边的点x为第一个点,其他所有点根据与点x连线的斜率排序,然后依次扫过去。如下图所示,线段ab相对于xa按逆时针旋转,所以a在当前确定的凸包集合中;线段bc相对于ab按顺时针方向旋转,所以b不在当前确定的凸包集合中;判断两向量的相对旋转方向可以用叉积来计算。a x b > 0 时b相对a逆时针旋转,> a...

2019-04-26 22:26:26 136

原创 全排列康托展开

传送门 排列的字典序问题题目描述n个元素{1,2,…, n }有n!个不同的排列。将这n!个排列按字典序排列,并编号为0,1,…,n!-1。每个排列的编号为其字典序值。例如,当n=3时,6 个不同排列的字典序值如下: 0 1 2 3 4 5123 132 213 231 312 321任务:给定n 以及n 个...

2019-04-26 22:01:03 91

原创 二分图性质

最小点覆盖=最大匹配最小边覆盖=v-最大匹配=最大独立集点覆盖、最小点覆盖点覆盖集即一个点集,使得所有边至少有一个端点在集合里。或者说是“点” 覆盖了所有“边”。。极小点覆盖(minimal vertex covering):本身为点覆盖,其真子集都不是。最小点覆盖(minimum vertex covering):...

2019-04-13 15:23:10 137

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除