自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

寻梦道理的专栏

深处寒夜, 把握星光.

  • 博客(16)
  • 收藏
  • 关注

原创 UESTC-1057 秋实大哥与花 (区间修改,区间求和)

https://vjudge.net/problem/UESTC-1057区间修改,一个个改复杂度是nlogn还不如暴力,这里用到线段树的lazy思想,保证复杂度为logn#include #include using namespace std;const int maxn = 1e5+6;int n,a[maxn],q;struct node{ int l,r;

2017-09-28 18:33:38 315

原创 [kuangbin带你飞]专题七 线段树 A - 敌兵布阵 (单点修改,区间求和)

https://vjudge.net/problem/UESTC-1057

2017-09-28 18:15:56 211

原创 [kuangbin带你飞]专题七 线段树 B - I Hate It(单点修改,区间最大值)

线段树基础题#include #include #include #define lid (id << 1)#define rid (id << 1 | 1)using namespace std;const int maxn=200005;struct node{ int l,r; int sum,Max;}tr[maxn*4];int a[maxn];

2017-09-27 01:51:16 264

原创 [kuangbin带你飞]专题十七 AC自动机 D Detect the Virus

https://vjudge.net/contest/70326#problem/D题意:给出n个编码后的模板串,然后有M次询问,每次询问输入一个编码后的文本串,问在编码前,有多少个模板串在文本串中出现过。所以本题的烦点在于还原的过程,由于解码后的字符的ASCII值是从0~255的,所以不能用strlen,得自己记录长度。然后还原思路是以4个原字母为单位 (因为需要6-位>

2017-09-25 20:59:22 342

原创 [kuangbin带你飞]专题十七 AC自动机 C - 病毒侵袭持续中

要输出每个字符串出现的次数,可以使用一个数组记录下。#include #include #include using namespace std;char str[1010][100];struct Trie{ int node[1010*50][128],fail[1010*50],num[1010*50]; int root,L; int newnode

2017-09-25 01:20:11 217

原创 [kuangbin带你飞]专题十七 AC自动机 B 病毒侵袭

http://acm.hdu.edu.cn/showproblem.php?pid=2896#include #include #include using namespace std;const int maxn=100010;struct Trie{ int node[maxn][128],fail[maxn],num[maxn],root,L; int ne

2017-09-25 00:39:05 201

原创 2017 ACM/ICPC Asia Regional Qingdao Online C The Dominator of Strings

#include #include #include #include #include #include #include #include #include #include using namespace std;#define INF 0x2fffffff#define LL long long#define MAX(a,b) ((a)>(b))?(a):(b)

2017-09-17 19:11:19 218

原创 2017 ACM-ICPC 亚洲区(西安赛区)网络赛 C Sum

Define the function S(x)S(x) for xx is a positive integer. S(x)S(x) equals to the sum of all digit of the decimal expression of xx. Please find a positive integer kk that S(k*x)\%233=0S(k∗x)%233

2017-09-16 18:01:30 635

原创 [kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher L(kmp扩展)

Link:https://vjudge.net/contest/70325#problem/L题意:第一行字符串是字母加密表,The first line of each test case is the conversion table S. S[i] is the ith latin letter's cryptographic letter.            第二行字符串是密文

2017-09-15 16:18:25 303

原创 [kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher K (kmp扩展)

https://vjudge.net/contest/70325#problem/K  HDU 3336题意:求字符串所有前缀在原串出现的次数思路:对自己求extend数组,遍历一遍相加就是结果.#include #include #include using namespace std;const int maxn=200000+5;char mode[maxn];int

2017-09-14 20:03:20 294

原创 [kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher J (kmp扩展)

Link:https://vjudge.net/contest/70325#problem/J题意:Write a program that, when given strings s1 and s2, finds the longest prefix of s1 that is a suffix of s2.(求s1的最长前缀 同时是s2的后缀.)思路:求s2的每个后缀与s1的公共前缀,

2017-09-14 18:07:36 228

原创 HDU 2222 (AC自动机)

http://acm.hdu.edu.cn/showproblem.php?pid=2222AC自动机模板题数组版本(参考kuangbin和昀神)写的精简巧妙,很喜欢.(找失败指针中,原来node[i][j]表示字典树i节点的字符为j的儿子的编号。现在扩展一下,如果i没有字符j这个儿子那么node[i][j]就是i节点沿着失败指针一直走到有字符为j的儿子的节点的编号,若不存在,指向根。相当于一个路...

2017-09-07 20:48:26 317

原创 HDU 3068 最长回文(Manacher)

题目:http://acm.hdu.edu.cn/showproblem.php?pid=3068求最长回文串的长度.裸的Manacher#include #include #include using namespace std;const int MAXN=110010;char Ma[MAXN*2];int Mp[MAXN*2]; void manacher(char

2017-09-07 20:41:25 212

原创 最小生成树 Prim和Kruskal(简单证明与模版)

步骤我们都知道,网上也有许多资料。对于这种贪心算法,我们往往听的时候一愣一愣的觉的很有道理,但我们也要问为什么这样做是对的,才能更有利于理解算法。Prim简单证明:(1)假设Prim算法得到树G,而最小生成树是T(2)设在生成G的过程中第一次产生的不在T中的边是e,(3)在G中去掉e得到的两个连通分支记为V1和V2,那么e连接了V1和V2(4)把e加入T之后会出现环,在这个

2017-09-06 22:52:32 1010 1

原创 [kuangbin带你飞]专题四 最短路练习 A-E

题目链接:https://vjudge.net/contest/66569#overviewA:#include #include #include using namespace std; const int maxn=1005; vector >E[maxn]; int dis[maxn]; bool vis[maxn]; void Ini

2017-09-05 20:44:21 260

原创 最短路 Dijkstra+优先队列与SPFA 模版

最短路最常用的两个算法,网上也有很多不同的写法,总结了下,最后参考了qsc B站视频的代码,因为比较精简.Dijkstra+优先队列 O(V+E)logV:Ps:我曾经思考过在稀疏图上优化过的版本比普通的Dijkstra上快是肯定的,但是在完全图上,E就是V2,那复杂度岂不是(V2+V)LogV 比V2还大,那优化什么?.不过查了资料说这只是理论上分析。在实际使用中由于他的入队条件往往得不到满足,...

2017-09-04 18:16:42 468

空空如也

空空如也

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

TA关注的人

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