- 博客(61)
- 收藏
- 关注
原创 codeforces 30E 蓝桥杯 Tricky and Clever Password
算法训练 Tricky and Clever Password 时间限制:2.0s 内存限制:256.0MB 问题描述 在年轻的时候,我们故事中的英雄——国王 Copa——他的私人数据并不是完全安全地隐蔽。对他来说是,这不可接受的。因此,他发明了一种密码,好记又难以破解。后来,他才知道这种密码是一个长度为奇数的回文串。 Copa 害怕
2016-02-18 11:20:47
3079
原创 POJ 1505 Copying Books
Copying BooksTime Limit: 3000MS Memory Limit: 10000KTotal Submissions: 7620 Accepted: 2405DescriptionBefore the invention of book-printing, it was very hard to
2016-01-27 21:31:10
812
原创 蓝桥杯 历届试题 格子刷油漆
历届试题 格子刷油漆 时间限制:1.0s 内存限制:256.0MB 问题描述 X国的一段古城墙的顶端可以看成 2*N个格子组成的矩形(如下图所示),现需要把这些格子刷上保护漆。 你可以从任意一个格子刷起,刷完一格,可以移动到和它相邻的格子(对角相邻也算数),但不能移动到较远的格子(因为油漆未干不能踩!) 比如:a d b
2016-01-20 20:20:34
1329
原创 HDU 3966 树链剖分模板
#include #include #include #include #include using namespace std;#define N 50010#define M 100010int n, m, p;class Node{public: int fa, top, pos, val, siz, heavySon, dep;};Node node[N]
2015-10-07 16:50:33
392
原创 hdu 5442 2015长春网络赛
Favorite DonutTime Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 478 Accepted Submission(s): 126Problem DescriptionLulu has a
2015-09-13 23:39:29
602
原创 2014ACM-ICPC亚洲区域西安赛区 G题 / GYM 100548 G
思路:利用回文树处理出两个串的每个回文串在该串中出现的次数,然后对回文树中的每个节点,用该节点所对应的回文串在第一个串中的出现次数乘上在第二个串中的出现次数,求和即可。处理出每个串中的每个回文串在该串中出现次数的方法是:考虑到回文树中的每个节点对应一个回文字串,先用第一个串构造出回文树,插入两个不同的没有出现的字符(使得两个串不相干),再插入第二个串,过程中分别记录每个节点在第一个串和第二
2015-08-31 23:06:10
1095
原创 hdu 5421 回文树
Victor and StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/262144 K (Java/Others)Total Submission(s): 56 Accepted Submission(s): 25Problem DescriptionVictor lov
2015-08-31 17:22:46
489
原创 hdu 5157 回文树
Harry and magic stringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 147 Accepted Submission(s): 72Problem DescriptionHarry
2015-08-30 23:09:21
683
原创 HDU 2296
思路:开个结构体,dp[i][j]记录从i号节点开始走j步能得到的最大的权值,以及走到最大权值的方案,还有答案,每次枚举能走到的所有点,更新答案,如果答案一样就选择字典序小的一个。也可以只记录走到该节点的父亲节点,这样每次答案一样时选字典小的就通过不断回退来确定。#include #include #include #include #include #include
2015-08-29 15:46:40
301
原创 KMP && AC自动机模板
KMP:获得next数组:void getNext(){ nxt[0] = -1; for(int i = 1; i < n; i++) { int p = nxt[i-1]; for(; p != -1 && str[p+1] != str[i]; p = nxt[p]); p = str[p+1] == str[
2015-08-27 23:19:30
331
原创 HDU 4468
SpyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 539 Accepted Submission(s): 262Problem Description“Be subtle! Be subtle! A
2015-08-26 22:45:39
596
原创 GYM 100523H
Afternoon Tea HERAvailable memory: 32MB.During his visit at Bytic Islands Byteasar really enjoyed the national beverage of Byteans, that is, tea with milk. This drink is always prepared in a stric
2015-08-25 13:42:06
407
原创 POJ 1478
Island of LogicTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 555 Accepted: 169DescriptionThe Island of Logic has three kinds of inhabitants: divine
2015-08-12 11:25:37
551
原创 HDU 4200
Bad WiringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 785 Accepted Submission(s): 263Problem DescriptionThe ninja Ryu has
2015-08-12 11:01:22
626
原创 HDU 4579
题意: 有n个节点,要从第一个节点移动到第n个节点,每次移动可能前进或者后退m步,概率通过给出的n×m的矩阵计算,问从第一个点道第n个点所走步数的数学期望。思路: n个未知数,设F[i]表示从第i点道第n点的期望的步数,则F[n] = 0, 可以列出n-1个F[i]和其他的F[]关系的方程。 n有50000,直接消元不仅会
2015-08-11 12:08:31
563
原创 POJ 3415
Common SubstringsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 8358 Accepted: 2761DescriptionA substring of a string T is defined as:T(i, k)=TiT
2015-08-08 09:38:56
368
原创 The Minimum Length KMP
The Minimum LengthTime Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionThere is a string A. The length of A is less than 1,000,000. I
2015-07-29 11:49:14
410
原创 POJ 1961
PeriodTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 14503 Accepted: 6892DescriptionFor each prefix of a given string S with N characters (each charact
2015-07-29 11:20:05
398
原创 HDU 3746
Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3931 Accepted Submission(s): 1768Problem DescriptionCC always
2015-07-28 17:23:02
601
原创 HDU 3416
Marriage Match IVTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2470 Accepted Submission(s): 742Problem DescriptionDo not si
2015-07-23 19:55:00
573
原创 HDU 3727 划分树
JewelTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1005 Accepted Submission(s): 249Problem DescriptionJimmy wants to make
2015-02-12 10:48:22
371
原创 HDU 1569 最大点权独立集
Problem Description给你一个m*n的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取数所在的2个格子不能相邻,并且取出的数的和最大。 Input包括多个测试实例,每个测试实例包括2整数m,n和m*n个非负数(m Output对于每个测试实例,输出可能取得的最大的和
2014-12-17 11:28:53
2039
原创 混合图欧拉回路 POJ 1637
Sightseeing tourTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7741 Accepted: 3242DescriptionThe city executive board in Lund wants to construct a si
2014-10-19 10:51:41
386
原创 KM算法模板 hdu2255
/*二分图最优匹配算法,邻接矩阵形式复杂度o(m^3)HDU 2255当前默认权值最大匹配*/#include#include#include#include#include#include#include#include#include#include#include# pragma comment (linker,"/STACK:16777216")u
2014-10-11 21:24:07
430
原创 后缀数组学习
最近学习后缀数组,主要也是通过国家集训队的那篇论文http://wenku.baidu.com/link?url=iu485CTU45uj_W0AorLHMqpwq6STXuFSdVLpcHtmlorb12354vGWVI7wZ2wgbnizd5z_kH2ZfOXanw6THQzeriEuxvcP-0_W66hlrSrNSOa
2014-09-29 08:44:05
476
原创 HDUOJ 4504 排列组合
Description 威威猫十分迷恋篮球比赛,是忠实的NBA球迷,他常常幻想自己那肥硕的身躯也能飞起扣篮。另外,他对篮球教练工作也情有独钟,特别是对比赛的战术,投篮选择方面也是很有研究,下面就是威威猫研究过的一个问题: 一场NBA篮球比赛总共48分钟,假如我们现在已经知道当前比分 A:B,A代表我方的比分,B代表对方的比分,现在比赛还剩下t秒时间。我们简单的认为双方各自进攻一
2014-09-10 21:57:53
437
原创 ZOJ 3818 正则表达式
Pretty PoemTime Limit: 2 Seconds Memory Limit: 65536 KB Poetry is a form of literature that uses aesthetic and rhythmic qualities of language. There are many famous poets in the contemp
2014-09-07 23:36:09
347
原创 HDU 4031 线段树
AttackTime Limit: 5000/3000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 1869 Accepted Submission(s): 540Problem DescriptionToday is the 10th Annu
2014-09-04 20:18:31
493
原创 POJ 1012 约瑟夫环
JosephTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 48092 Accepted: 18144DescriptionThe Joseph's problem is notoriously known. For those who are not
2014-09-03 15:24:38
400
原创 POJ 1990 树状数组
MooFestTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 5269 Accepted: 2274DescriptionEvery year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",
2014-09-03 15:02:01
329
原创 POJ 2481 树状数组
CowsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 12764 Accepted: 4237DescriptionFarmer John's cows have discovered that the clover growing alon
2014-09-03 14:37:33
337
原创 POJ 3469 最大流
Dual Core CPUTime Limit: 15000MS Memory Limit: 131072KTotal Submissions: 18948 Accepted: 8179Case Time Limit: 5000MSDescriptionAs more and more computers ar
2014-08-24 10:43:38
376
原创 HDUOJ 2195 二分图最优匹配
Going HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 17793 Accepted: 9070DescriptionOn a grid map there are n little men and n houses. In each unit t
2014-08-06 22:19:29
358
原创 POJ 2502 Subway 单源点最短路模板
SubwayTime Limit: 1000MS Memory Limit: 65536K
2014-07-30 16:58:38
383
原创 POJ 1094 拓扑排序
Sorting It All OutTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 27010 Accepted: 9336DescriptionAn ascending sorted sequence of distinct values is one in
2014-07-28 18:39:28
430
原创 HDU 1255 扫描线
覆盖的面积Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3555 Accepted Submission(s): 1744Problem Description给定平面上若干矩形,求出被这些矩形覆盖过至
2014-07-28 15:41:26
347
原创 POJ 2528 线段树+离散化
Mayor's postersTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 40934 Accepted: 11911DescriptionThe citizens of Bytetown, AB, could not stand that the cand
2014-07-26 15:39:23
469
原创 2014 多校联赛第一场 1010Rating
RatingTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Special JudgeProblem Description A little
2014-07-22 17:06:08
601
原创 ZOJ 3471 状压DP
Most PowerfulTime Limit: 2 Seconds Memory Limit: 65536 KBRecently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When
2014-07-22 10:12:17
408
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人