自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Codeforces F. Maxim and Array(构造贪心)

题目描述:Maxim and Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently Maxim has found an array of n integers, needed by no o...

2019-08-16 19:09:00 156

转载 Codeforces A. Playlist(暴力剪枝)

题目描述:Playlisttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a playlist consisting of n songs. The -th song is characteriz...

2019-08-16 15:25:00 175

转载 Codeforces H. Kilani and the Game(多源BFS)

题目描述:Kilani and the Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKilani is playing a game with his friends. This game can be...

2019-08-16 13:57:00 215

转载 Codeforces E. High Load(构造)

题目描述:High Loadtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputArkady needs your help again! This time he decided to build his own h...

2019-08-15 10:55:00 153

转载 P4781 【模板】拉格朗日插值

题目描述:题目背景这是一道模板题题目描述由小学知识可知,n个点\((x_i,y_i)\)可以唯一地确定一个多项式现在,给定n个点,请你确定这个多项式,并将k代入求值求出的值对998244353取模输入格式第一行两个正整数n,k,含义如题接下来nnn行,每行两个正整数x_i,y_i,含义如题输出格式一个整数表示答案输入输出样例输入 #13 1001 42 9...

2019-08-13 23:05:00 74

转载 Codeforces D. The Sum of the k-th Powers(拉格朗日插值)

题目描述:The Sum of the k-th Powerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are well-known formulas: , , . Also mathematic...

2019-08-13 21:23:00 172

转载 Codeforces G. The Brand New Function(枚举)

题目描述:The Brand New Functiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus has a sequence, consisting of n non-negative ...

2019-08-13 16:30:00 133

转载 Codeforces J. Sagheer and Nubian Market(二分枚举)

题目描述:Sagheer and Nubian Markettime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn his trip to Luxor and Aswan, Sagheer went to a Nub...

2019-08-13 14:09:00 122

转载 Codeforces J. Soldier and Number Game(素数筛)

题目描述:Soldier and Number Gametime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo soldiers are playing a game. At the beginning first...

2019-08-12 19:34:00 109

转载 Manacher算法(马拉车)求最长回文子串

Manacher算法求最长回文字串算法思路按照惯例((・◇・)?),这里只是对算法的一些大体思路做一个描述,因为找到了相当好理解的博客可以参考(算法细节见参考文章)。一般而言,我们的判断回文算法的思想是从一个点开始向两边拓展直到无法拓展为止,这个时候就得到了回文串的长度,但这个算法的时间复杂度是\(O(n^2)\)的。在这个算法进行的过程中,我们有可能会不断地拓展了重复的位置而产生...

2019-08-12 11:08:00 86

转载 Codeforces A. Kyoya and Colored Balls(分步组合)

题目描述:Kyoya and Colored Ballstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKyoya Ootori has a bag with n colored balls that are co...

2019-08-11 22:12:00 141

转载 Codeforces I. Producing Snow(优先队列)

题目描述:C. Producing Snowtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice likes snow a lot! Unfortunately, this year’s winter is a...

2019-08-11 20:02:00 118

转载 Codeforces K. Ice Skating(求强连通分量)

题目描述:Ice Skatingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBajtek is learning to skate on ice. He's a beginner, so his only mo...

2019-08-11 13:53:00 176

转载 Codeforces H. Prime Gift(折半枚举二分)

题目描述:Prime Gifttime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOpposite to Grisha's nice behavior, Oleg, though he has an entire ...

2019-08-11 11:35:00 150

转载 Codeforces A. Password(KMP的nxt跳转表)

题目描述:Passwordtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAsterix, Obelix and their temporary buddies Suffix and Prefix has fina...

2019-08-10 22:44:00 102

转载 Codeforces B. Bad Luck Island(概率dp)

题目描述:Bad Luck Islandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Bad Luck Island is inhabited by three kinds of species: r r...

2019-08-10 20:57:00 139

转载 Codeforces C Match Points(二分贪心)

题目描述:Match Pointstime limit per test2 secondsmemory limit per test256 mega bytesinputstandard inputoutputstandard outputYou are given a set of points x1, , ..., *x**n*Two points iand j...

2019-08-10 20:35:00 164

转载 求逆元的四种算法(拓欧费马小线性推欧拉)

求逆元的四种算法拓展欧几里得算法求逆元上一篇博客中已经讲过拓展欧几里得算法,并且讲解了求逆元的原理。这里只列出代码在要求逆元的数与p互质时使用代码//扩展欧几里得定理int ex_gcd(int a,int b,int& x,int& y){ if(b==0) { x=1; y=0; retur...

2019-08-10 10:44:00 204

转载 扩展欧几里得算法

拓展欧几里得算法先来看看一个重要的基本定理裴蜀定理对于整数a,b,他们关于x,y的线性不定方程\(ax+by=d\),设\(gcd(a,b)=g\),则可证明\(g|d\),换句话说,就是g是a,b的最小线性组合。证明:设\(ax+by=d\),\(g=gcd(a,b)\),设\(ax+by\)的最小值为s,\(\because\) \(g|a,g|b\)\(\theref...

2019-08-09 21:49:00 100

转载 P3376 【模板】网络最大流

题目描述:题目描述如题,给出一个网络图,以及其源点和汇点,求出其网络最大流。输入格式第一行包含四个正整数N、M、S、T,分别表示点的个数、有向边的个数、源点序号、汇点序号。接下来M行每行包含三个正整数ui、vi、wi,表示第i条有向边从ui出发,到达vi,边权为wi(即该边最大流量为wi)输出格式一行,包含一个正整数,即为该网络的最大流。输入输出样例输入 #14 5 ...

2019-08-09 13:22:00 99

转载 KM(Kuhn-Munkres)算法求带权二分图的最佳匹配

KM(Kuhn-Munkres)算法求带权二分图的最佳匹配相关概念这个算法个人觉得一开始时有点难以理解它的一些概念,特别是新定义出来的,因为不知道是干嘛用的。但是,在了解了算法的执行过程和原理后,这些概念的意义和背后的作用就渐渐的显示出来了。因此,先暂时把相关概念列出来,看看,有个大概印象就好,等到了解了算法的流程后,在看原理中会有这些概念,那个时候回来细看就好了。完备匹配:定义 ...

2019-08-09 12:17:00 432

转载 二分图匹配算法(最大流匈牙利)

二分图匹配相关概念无向二分图\(G(U\bigcup V,E)\):U是一个顶点集合,V是另一个顶点集合,对于一个集合内的点无边直接相连,而对于不同集合的点可以连边,即\((u,v)\in E\)。匹配:两两不含公共端点的边的集合M称为匹配(就是两个集合之间连的边,只不过不同边的端点不能重合)最大匹配:元素最多的M,即而G中两两不含公共端点的边的集合\(M\subseteq E\...

2019-08-08 20:14:00 239

转载 KMP算法模板

KMP算法模板原理见参考文章模板#include <iostream>#include <cstring>#define max_n 100005using namespace std;char s[max_n] = {'a','a','b','a','a','a','b','c'};char p[max_n] = {'a','a','a','b...

2019-08-08 10:16:00 59

转载 Codeforces G. Ciel the Commander

题目描述:Ciel the Commandertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNow Fox Ciel becomes a commander of Tree Land. Tree Land, lik...

2019-08-07 14:21:00 109

转载 点分治模板

点分治模板点分治:这里统一地,只讲一下主要思想,各种细节留给参考文章。点分治的主要是处理树上的路径问题,如果用暴力做法求解会有很高的时间复杂度\(O(n^2)-O(n^3)\)的样子。而如果使用点分治,就可以将复杂度降为\(O(nlog_2n)\)。主要思路是将一棵树分解成若干子树,在分解成子树的子树,递归地求解出部分答案(分),最后在递归回去时合并答案(治)。至于怎么分解树,这里...

2019-08-07 10:38:00 77

转载 Codeforces I. Vessels(跳转标记)

题目描述:Vesselstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a system of n vessels arranged one above the other as shown in...

2019-08-06 17:37:00 122

转载 Codeforces C. Maximum Value(枚举二分)

题目描述:Maximum Valuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a sequence a consisting of n integers. Find the maxi...

2019-08-06 13:29:00 122

转载 Codeforces D. Little Elephant and Interval(思维找规律数位dp)

题目描述:Little Elephant and Intervaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Little Elephant very much loves sums on interv...

2019-08-06 11:10:00 175

转载 [USACO15DEC]最大流Max Flow(树上差分)

题目描述:Farmer John has installed a new system of N−1N-1N−1 pipes to transport milk between the NNN stalls in his barn (2≤N≤50,0002 \leq N \leq 50,0002≤N≤50,000), conveniently numbered 1…N1 \ldots ...

2019-08-04 21:45:00 104

转载 Codeforces E. Alyona and a tree(二分树上差分)

题目描述:Alyona and a treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlyona has a tree with n vertices. The root of the tree is th...

2019-08-04 20:07:00 146

转载 倍增法求lca(最近公共祖先)

倍增法求lca(最近公共祖先)基本上每篇博客都会有参考文章,一是弥补不足,二是这本身也是我学习过程中找到的觉得好的资料思路:大致上算法的思路是这样发展来的。想到求两个结点的最小公共祖先,我们可以先把两个的深度提到同一水平,在一步一步往上跳,直到两个结点有了一个公共祖先,依照算法流程,这就是least common ancestor。但是如果这样一步步地往上未免太让人着急,为了提...

2019-08-04 19:32:00 128

转载 Codeforces C. Jzzhu and Cities(dijkstra最短路)

题目描述:Jzzhu and Citiestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJzzhu is the president of country A. There are n cities number...

2019-08-04 11:08:00 118

转载 Codeforces B. Mouse Hunt(强连通分解缩点)

题目描述:Mouse Hunttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMedicine faculty of Berland State University has just finished their...

2019-08-03 19:42:00 168

转载 Tarjan算法分解强连通分量(附详细参考文章)

Tarjan算法分解强连通分量算法思路:算法通过dfs遍历整个连通分量,并在遍历过程中给每个点打上两个记号:一个是时间戳,即首次访问到节点i的时刻,另一个是节点u的某一个祖先被访问的最早时刻。时间戳用DFN数组存储,最早祖先用low数组来存,每次dfs遍历到一个节点u,即让这两个记号等于当前时刻,在后面回溯或者判断的过程中在来更新low,DNF是一定的,因为第一次访问时刻一定。然后...

2019-08-03 19:41:00 104

转载 Codeforces A. Game on Tree(期望dfs)

题目描述:Game on Treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMomiji has got a rooted tree, consisting of n nodes. The tree nodes...

2019-08-03 11:21:00 135

转载 链式前向星

链式前向星在之前先来看一下边集数组。边集数组是图的表示法的一种,前向星是边集数组的一种,链式前向星是前向星的一种。前向星前向星是把边的起点从小到大排序,起点一样按同样的规则排终点。所以前向星使用之前要\(O(nlog_2n)\)排序一下。使用两个数组,一个head,head[i]记录以i为起点的边在边的数组里面的第一个位置,一个len,len[i]记录以i为起点的边有多少条。...

2019-08-03 11:21:00 127

转载 Codeforces G. Bus Number(dfs排列)

题目描述:Bus Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis night wasn't easy on Vasya. His favorite team lost, and he didn'...

2019-08-03 11:20:00 182

转载 Codeforces H. Malek Dance Club(找规律)

题目描述:Malek Dance Clubtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs a tradition, every year before IOI all the members of Natali...

2019-08-03 11:20:00 157

转载 Codeforces I. Inna and Nine(组合)

题目描述:Inna and Ninetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInna loves digit 9 very much. That's why she asked Dima to write a...

2019-08-03 11:19:00 109

转载 Codeforces J. Monotonic Renumeration(组合)

题目描述:You are given an array consisting of nmonotonic renumeration as an array b consisting of \(n\)integers such that all of the following conditions are met:b1=0;for every pair of indices ia...

2019-08-03 11:17:00 130

空空如也

空空如也

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

TA关注的人

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