随笔分类 - ICPC算法生涯
摘要:##HDU 1251 - 统计难题 ###Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). ###Input 输入数据的第一部分是一张单词
阅读全文
摘要:题意:有n个问题,做第i个问题得分是t*a[i]+bi, 但是做第i题之前还需要先做其他的一些题目….可以选择不做完所有的题,问最后的最高得分. 思路:深搜就可以了,跟很多深搜的问题一样,有很多重复的子问题,此题的记忆化很奇特用的二进制类似状压的思想 AC code:
阅读全文
摘要:A square-free integer is an integer which is indivisible by any square number except 11. For example, 6 = 2 \cdot 36=2⋅3 is square-free, but 12=22∗312
阅读全文
摘要:###Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: ###Input 第一行为n,表示操作的个数,下面n行每行有两个数opt和x,opt表示操作的序号(1<=opt<=6) ###Output 对于操作3,4,5,6每行输出一个数,表示对应答案
阅读全文
摘要:There are N cities in the country, and M directional roads from u to v(1≤u,v≤n). Every road has a distance cici Haze is a Magical Girl that lives in C
阅读全文
摘要:Problem Description There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this “How
阅读全文
摘要:先来一段代码压压惊: 想像一下对于一个字符串,如何求它的最长的回文子串,暴力的做法就是枚举每一个点然后往两边扩,但是这个算法的时间复杂度是O(n2)O(n^2)O(n2)时间很不进人意,于是就诞生了Manacher算法 Manacher 开始Manacher之前我们首先要准备两个变量maxr和mid
阅读全文
摘要:In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacen
阅读全文
摘要:Problem Description CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there a
阅读全文
摘要:Describe 有一个神奇的盒子,它有N (2 <= N <= 1e5)个空间,这些空间依次编号为a1,…,aN (0 <= ai <= 1e9). 有x (2 <= x <= N)巧克力,如果多个巧克力放在一个空间就会爆炸。为了不让巧克力爆炸。我们需要使任意两个巧克力之间的最小距离尽可能的大,那
阅读全文
摘要:Hotel Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake
阅读全文
摘要:题意: 五百年后,龙珠的数量会出乎意料地增加,因此孙悟空(吴)将所有的龙球聚集在一起太难了。 他的国家有N个城市,世界上正好有N个龙球。起初,对于第i个龙球,神圣的龙将把它放在第i个城市。长年以来,一些城市的龙球将被运往其他城市。为了挽救体力,吴孔计划采用飞行云中云,一种神奇的飞云收集龙珠。 每次武
阅读全文
摘要:Description Every cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <=
阅读全文
摘要:Problem Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Gen
阅读全文
摘要:Vasya’s house is situated in a forest, and there is a mushroom glade near it. The glade consists of two rows, each of which can be divided into n cons
阅读全文
摘要:LCS 最长公共子序列,大神博客 在这里不再 一 一 赘述LCS,如果为小白请参见链接, 接下来谈一下LCS的路径回溯问题,大神的博客中已经提到了一种路径回溯的方法,我这里在提供一种以供选择 code: LIS 最长上升子序列, 大神博客 LIS重点是在第二种贪心加二分的求法,第三种着重掌握树状数组
阅读全文
摘要:01背包 01背包是所有背包的基础,很重要也很基础而且最重要的是有很多变形,能够运用得非常灵活,网上有很好的介绍01背包的博客我在这里就不写他的原理和详细步骤了,只是转载一下他们的博客,包括下面的完全背包,多维背包 等等,我想写这篇博客的主要目的是介绍背包的用法,当然了转载的博客是很基础的,因此小白
阅读全文
摘要:描述 给出一组长度为n的序列,a1a2a3......ana1a2a3......an求出这个序列长度为kk的严格递增子序列的个数 输入 第一行输入T组数据 T (0≤T≤10) 第二行输入序列大小n(1≤n≤100),长度k(1≤k≤n) 第三行输入n个数字 输出 数据规模很大, 答案请对1e9+
阅读全文
摘要:Multivariate function 描述 输入 第一行一个整数T,表示T组测试数据 (1≤T≤10). 每组数据第一行一个整数n(4≤n≤1000). 第二行 n个浮点数: X1,X2X3......Xn(1<=Xi<=1000000)X1,X2X3......Xn(1<=Xi<=10000
阅读全文
摘要:Mayor’s posters Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their
阅读全文

浙公网安备 33010602011771号