![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
暑假集训
Flyppy_White
这个作者很懒,什么都没留下…
展开
-
夏季训练DAY1(stl+模拟)
A题http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2018A - Game Rank CSU - 2018 DescriptionThe gaming company Sandstorm is developing an online two player game. You have been asked to impl...原创 2018-07-23 22:11:59 · 345 阅读 · 0 评论 -
Number Sequence HDU - 1711 (Hash或KMP)
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K ...原创 2018-08-14 13:43:40 · 152 阅读 · 0 评论 -
Prefixes and Suffixes CodeForces - 432D (KMP的next数组的应用)(图解)
Prefixes and Suffixes CodeForces - 432D You have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character.Let's introduce several definitions:A substring s[i..j...原创 2018-08-14 13:40:03 · 169 阅读 · 0 评论 -
AC自动机模板(摘自刘汝佳紫书,无指针)
本题的题目选择的是病毒侵袭持续中 HDU - 3065 const int size=5e4+5;const int SIGMA_SIZE=26;int trie[size][26],val[size];char s_save[1005][60],s_fin[2000005];int f[size];int last[size];int tot=1;int sum[10...原创 2018-08-14 13:21:16 · 383 阅读 · 0 评论 -
KiKi's K-Number HDU - 2852 (树状数组求第K大,O(N)算法)
KiKi's K-Number HDU - 2852 For the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to design a container...原创 2018-08-14 13:18:00 · 237 阅读 · 0 评论 -
Ultra-QuickSort POJ - 2299 (归并排序求逆序对(带原理简介))
In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted i...原创 2018-08-14 13:12:14 · 1048 阅读 · 0 评论 -
树状数组与离散化与求第K大模板
树状数组模板://Cnt为数组的界//cnt[i]为编号或者数值上小于id的数量void Update(LL Id){ while(Id<=Cnt) { cnt[Id]++; Id+=lowbit(Id); }}LL num(LL Id){ LL ans=0; while(Id>0) { ans+=cnt[Id]; Id-=lowbit(I...原创 2018-08-14 12:57:51 · 182 阅读 · 0 评论 -
斜率小于0的连线数量 51Nod - 1107 (树状数组+离散化)
二维平面上N个点之间共有C(n,2)条连线。求这C(n,2)条线中斜率小于0的线的数量。二维平面上的一个点,根据对应的X Y坐标可以表示为(X,Y)。例如:(2,3) (3,4) (1,5) (4,6),其中(1,5)同(2,3)(3,4)的连线斜率 < 0,因此斜率小于0的连线数量为2。Input第1行:1个数N,N为点的数量(0 <= N <= 50000) 第...原创 2018-08-14 12:47:41 · 163 阅读 · 0 评论 -
暑假训练DAY15(并查集,最小生成树)
The Suspects UVA - 1197 并查集模板题,记得维护一下并查集的大小就好代码:#include<algorithm>#include<iostream>#include<cstring>#include<string>#include<cstdio>#include<vector&g...原创 2018-08-06 20:27:24 · 222 阅读 · 0 评论 -
E - Blue Jeans POJ - 3080 (Hash+暴力)
E - Blue Jeans POJ - 3080 The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map ...原创 2018-08-14 13:50:06 · 181 阅读 · 0 评论 -
Cyclic Nacklace HDU - 3746 (Next数组求循环节)
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to...原创 2018-08-14 14:02:34 · 141 阅读 · 0 评论 -
暑假训练DAY25数论初步
数论二·Eular质数筛法 HihoCoder - 1295 描述小Ho:小Hi,上次我学会了如何检测一个数是否是质数。于是我又有了一个新的问题,我如何去快速得求解[1,N]这个区间内素数的个数呢?小Hi:你自己有什么想法么?小Ho:有!我一开始的想法是,自然我们已经知道了如何快速判定一个数是否是质数,那么我就直接将[1,N]之间每一个数判定一次,就可以得到结果。但我发现这个方...原创 2018-08-17 19:26:06 · 273 阅读 · 0 评论 -
暑假训练DAY26组合数学
神、上帝以及老天爷 HDU - 2048 HDU 2006'10 ACM contest的颁奖晚会隆重开始了! 为了活跃气氛,组织者举行了一个别开生面、奖品丰厚的抽奖活动,这个活动的具体要求是这样的: 首先,所有参加晚会的人员都将一张写有自己名字的字条放入抽奖箱中; 然后,待所有字条加入完毕,每人从箱中取一个字条; 最后,如果取得的字条上写的就是自己的名字,那么“恭喜你,中奖了!”...原创 2018-08-17 19:14:28 · 313 阅读 · 0 评论 -
数论初步(欧几里得算法&求解模线性方程&求解模线性方程组&求逆元)
最大公约数的辗转相除法(欧几里得算法)证明:给出两个数a和b,求其最大公约数。设a%b=y;则a=k*b+y(k为一整数)设a,b的最小公约数为u则:(k*b+y)%u=0; b%u=0;由(2)式可知k*b%u=0,所以y%u=0所以a,b的最小公约数就可以转换为b,y的最小公约数。因此就可以通过不断递归,向下进行计算直到a%b=0时,就有b为最大公倍数。...原创 2018-08-16 15:17:42 · 2801 阅读 · 0 评论 -
2151: 集训难度(包含两种操作的线段树)
2151: 集训难度Submit Page Summary Time Limit: 1 Sec Memory Limit: 512 Mb Submitted: 55 Solved: 12 Description小L正在组织acm暑假集训,但众所周知,暑假集训的萌新中有OI神犇,也有暑假才开始学算法的萌新,如果统一集训的难度,无法很好地让萌新们得...原创 2018-08-18 14:21:53 · 142 阅读 · 0 评论 -
疯狂的企鹅 CSU - 2147 (队列+双向链表维护)
在鹅厂工作的DJ开始训练起了鹅厂的企鹅们,现在DJ教小企鹅玩一个疯狂的游戏(危险游戏,小朋友请勿模仿)。现在有一排小企鹅,从左到右编号为1....N,每个小企鹅有一个数字,每天早上,如果一个小企鹅发现他右边的小企鹅的数字比他的小,他就会消灭这个小企鹅。问到了第几天才会没有小企鹅可以被消灭,你需要输出天数-1的值注:所有小企鹅的数字是1...N的排列Input每组数据输入格式...原创 2018-08-15 20:20:02 · 264 阅读 · 0 评论 -
线段树模板
点的修改:#include<algorithm>#include<iostream>#include<cstring>#include<string>#include<cstdio>#include<vector>#include<stack>#include<cmath&原创 2018-08-15 12:33:43 · 99 阅读 · 0 评论 -
Mars UVALive - 8331 (Hash+DFS)
A new form of life is recently discovered on Mars. Every alien has a DNA, that is a string with an alphabet of only two, rather than four, letters. Hence we can show the DNA of a Mars alien by a binar...原创 2018-08-12 11:19:09 · 165 阅读 · 0 评论 -
Mayor's posters POJ - 2528 (离散化+线段树)
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d...原创 2018-08-14 18:46:04 · 318 阅读 · 0 评论 -
暑假训练DAY13测验(简单DP区间DP树型DP)
A - Tri Tiling POJ - 2663 In how many ways can you tile a 3xn rectangle with 2x1 dominoes? Here is a sample tiling of a 3x12 rectangle. InputInput consists of several test cases followed by...原创 2018-08-06 19:11:45 · 479 阅读 · 0 评论 -
暑假训练DAY12(区间DP与树型DP)
1592:石子归并提交页面 概要 时间限制: 1秒 内存限制:128 Mb已 提交: 913已 解决: 435 描述现在有Ñ堆石子,第我堆有人工智能个石子。现在要把这些石子合并成一堆,每次只能合并相邻两个,每次合并的代价是两堆石子的总石子数。求合并所有石子的最小代价。 输入第一行包含一个整数T(T <= 50),表示数据组数。...原创 2018-08-05 20:59:38 · 248 阅读 · 0 评论 -
暑假训练DAY6 csu七月月赛(水题部分)
A - 商 CSU - 2143 编一个程序求A/B的值 ,要求精确到小数点后N位(N<=80的自然数,并且A<B,A和B是整型 数范围),不足N位的用“0”补齐。例如:精确到小数点后9位:6/7=0.857142857。输入A、B、N, 求A/B。Input输入文件: 只有一行,就是A,B,N,Output输出文件: 只有一行,就是A/B的结果。Sampl...原创 2018-07-29 21:51:38 · 277 阅读 · 0 评论 -
二维计算几何模板
本模板主要来自刘汝佳的《算法竞赛入门经典》,部分缺省的地方我进行了补齐,且对每个函数作出了解释/*****************************************************************点和向量的声明,以及加减,数乘比较等基础操作 ********************************************************...原创 2018-07-29 20:38:01 · 206 阅读 · 0 评论 -
关于曲线分割平面问题
问题一:n条直线在平面上相交所能分割出的平面最多有多少?解:设i条直线所能分割出的平面最多为f(i),则n-1条能分割出f(n-1),n条能分割出f(n)。可以观察得当新增的直线与之前的所有直线均相交且交点重复时有最大增加量为n。因此得到f(n)=f(n-1)+n.再使用累加法与f(1)=2的结论可得f(n)=n*(n+1)/2+1。问题二:n条v型线在平面上相交所能分割出...原创 2018-07-26 14:09:20 · 1291 阅读 · 0 评论 -
DAY3(测验)(模拟&stl&二分)
A - Tricky Sum CodeForces - 598A http://codeforces.com/problemset/problem/598/Atime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output...原创 2018-07-25 23:15:25 · 207 阅读 · 0 评论 -
暑假训练DAY5(深度优先搜索dfs)
#1049 : 后序遍历时间限制:10000ms单点时限:1000ms内存限制:256MB描述在参与过了美食节之后,小Hi和小Ho在别的地方又玩耍了一阵子,在这个过程中,小Ho得到了一个非常有意思的玩具——一棵由小球和木棍连接起来的二叉树!小Ho对这棵二叉树爱不释手,于是给它的每一个节点都标记了一个标号——一个属于A..Z的大写字母,并且没有任意两个节点的标号是一样的。小H...原创 2018-07-28 18:28:47 · 150 阅读 · 0 评论 -
夏季训练DAY2(二分&三分)
A - 例题 HDU - 2141 http://acm.hdu.edu.cn/showproblem.php?pid=2141Can you find it?Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/10000 K (Java/Others)Total Submission(s): 41092 ...原创 2018-07-24 21:18:24 · 188 阅读 · 0 评论 -
H - Numbers HDU - 6168 (贪心+multiset)
http://acm.hdu.edu.cn/showproblem.php?pid=6168Problem Descriptionzk has n numbers a1,a2,...,an. For each (i,j) satisfying 1≤i<j≤n, zk generates a new number (ai+aj). These new numbers could mak...原创 2018-07-24 19:15:46 · 117 阅读 · 0 评论 -
(bfs+二分)2112: Wells的明星生活
很久之前就看到这个题目,今天第一次做出来,纪念一下2112: Wells的明星生活csuoj2112http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2112Description和很多人想的不同,Wells其实是很低调的。刚刚过了520和521,爱信不信,巨怂Wells和喜欢的小姐姐表白了!Wells那是相当相当低调...原创 2018-07-24 16:02:07 · 155 阅读 · 0 评论 -
csu2146 神奇的金字塔(寻找通项)
D - 神奇的金字塔 CSU - 2146 总所周知,CSU没有金字塔,但在世界某地有一座神奇的金字塔。神奇的金字塔位于N*N的网格地上。第0分钟时,金字塔底面很小,只占据(x,y) 这个格子,之后每过一分钟,金字塔会长大,就算超过边界也会继续长大,不过边界外是无限深渊,所以超过边界的部分不算占据的面积,而且由于是无限深渊,不需要考虑什么时候被填满的问题。那么现在问题来...原创 2018-07-29 22:33:57 · 216 阅读 · 0 评论 -
暑假训练DAY7(计算几何)
B - 直线相交 POJ - 1269 We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they ar...原创 2018-07-29 23:04:03 · 174 阅读 · 0 评论 -
暑假训练DAY11动态规划
A - Race UVA - 12034 Description Tamim and Lina, two of the biggest mega minds of Bangladesh went to a far country. They ate, coded and wandered around, even in their holidays. They passed sev...原创 2018-08-05 20:33:09 · 379 阅读 · 0 评论 -
2087: Tragedy Words(dfs)
2087: Tragedy WordsSubmit Page Summary Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 144 Solved: 58 Description As is known to all, Wells doesn't have a good command of...原创 2018-07-28 08:37:16 · 198 阅读 · 0 评论 -
2061: Z‘s Coffee(bfs或dfs+记录路径)
2061: Z‘s Coffeehttp://acm.csu.edu.cn/csuoj/problemset/problem?pid=2061Submit Page Summary Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 120 Solved: 40 SpecialJudgeDesc...原创 2018-07-28 08:30:46 · 173 阅读 · 0 评论 -
暑期训练DAY9(贪心)
1588: 合并果子Submit Page Summary Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 1905 Solved: 905 Description现在有n堆果子,第i堆有ai个果子。现在要把这些果子合并成一堆,每次合并的代价是两堆果子的总果子数。求合并所有果子的最小代价。...原创 2018-07-31 20:36:59 · 334 阅读 · 0 评论 -
暑假训练DAY8(BFS)
Oil DepositsTime Limit: 2 Seconds Memory Limit: 65536 KBThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectang...原创 2018-07-31 09:11:08 · 519 阅读 · 0 评论 -
暑假训练DAY10测试(贪心+BFS)(水题部分)
A. Pythagorean Theorem IICodeForces - 304A http://codeforces.com/problemset/problem/304/Atime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstan...原创 2018-08-03 21:57:14 · 237 阅读 · 0 评论 -
暑假训练DAY4(递推&递归)
一只小蜜蜂...http://acm.hdu.edu.cn/showproblem.php?pid=2044Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 93324 Accepted Submission(s): 3322...原创 2018-07-26 23:08:34 · 196 阅读 · 0 评论 -
1081. Binary Lexicographic Sequence(找规律)
1081. Binary Lexicographic Sequencehttp://acm.timus.ru/problem.aspx?space=1&num=1081Time limit: 0.5 secondMemory limit: 64 MBConsider all the sequences with length (0 < N < 44), conta...原创 2018-07-26 22:50:42 · 176 阅读 · 0 评论 -
暑假训练DAY29(LCA与树链剖分)
How far away ? HDU - 2586 There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A t...原创 2018-08-20 20:22:48 · 255 阅读 · 0 评论