自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 快速傅里叶变换学习笔记

(转载请注明原帖地址:http://www.cnblogs.com/yyf0309/p/FFT.html,转载不注明地址必究,如果读到任何有问题的地方,请先阅读文章末尾)(这里做一个约定,下文中的$\mod n$表示对$n$取模的剩余。在数学中的真实定义其实是$a \mod n = \left\{ x | x = kn + a\ \left(k\in Z \right) \righ...

2017-07-31 19:38:00 235

转载 Codeforces 235C Cyclical Quest - 后缀自动机

Some days ago, WJMZBMR learned how to answer the query "how many times does a string x occur in a string s" quickly by preprocessing the string s. But now he wants to make it harder.So he wan...

2017-07-30 21:53:00 144

转载 bzoj 3262 陌上花开 - CDQ分治 - 树状数组

Description有n朵花,每朵花有三个属性:花形(s)、颜色(c)、气味(m),又三个整数表示。现要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量。定义一朵花A比另一朵花B要美丽,当且仅当Sa>=Sb,Ca>=Cb,Ma>=Mb。显然,两朵花可能有同样的属性。需要统计出评出每个等级的花的数量。Input第一行为N,K (1 &lt...

2017-07-29 17:33:00 84

转载 bzoj 1176 [Balkan2007]Mokia - CDQ分治 - 树状数组

Description维护一个W*W的矩阵,初始值均为S.每次操作可以增加某格子的权值,或询问某子矩阵的总权值.修改操作数M<=160000,询问数Q<=10000,W<=2000000.Input第一行两个整数,S,W;其中S为矩阵初始值;W为矩阵大小接下来每行为一下三种输入之一(不包含引号):"1 x y a""2 x1 y1 x2 y2""...

2017-07-29 11:24:00 79

转载 bzoj 4810 由乃的玉米田 - bitset - 莫队算法

由乃在自己的农田边散步,她突然发现田里的一排玉米非常的不美。这排玉米一共有N株,它们的高度参差不齐。由乃认为玉米田不美,所以她决定出个数据结构题这个题是这样的:给你一个序列a,长度为n,有m次操作,每次询问一个区间是否可以选出两个数它们的差为x,或者询问一个区间是否可以选出两个数它们的和为x,或者询问一个区间是否可以选出两个数它们的乘积为x ,这三个操作分别为操作1...

2017-07-29 09:11:00 88

转载 bzoj 3687 简单题 - bitset

Description小呆开始研究集合论了,他提出了关于一个数集四个问题: 1.子集的异或和的算术和。 2.子集的异或和的异或和。 3.子集的算术和的算术和。 4.子集的算术和的异或和。 目前为止,小呆已经解决了前三个问题,还剩下最后一个问题还没有解决,他决定把 这个问题交给你,未来的集训队队员来实现。Input第一行,一个整数n。 第二行,n个正整数,表...

2017-07-28 22:00:00 96

转载 UVa 12099 The Bookcase - 动态规划

  题目大意 给定一些书,每个书有一个高度和宽度,然后将它们放到一个三层的书架里(要求每一层都不为空)。定义书架的大小为每层最大的高度和 乘 每层宽度和的最大值。求最小的书架大小。  显然动态规划(直觉,没有为什么)。  然后确定状态,f[i][j][k]表示正在考虑第i本书,第2层的宽度和为j,第3层的宽度和为k(这样第一层的宽度和就可以计算出来)最小的高度和。然...

2017-07-28 19:56:00 128

转载 bzoj 2565 最长双回文串 - Manacher

顺序和逆序读起来完全一样的串叫做回文串。比如acbca是回文串,而abc不是(abc的顺序为“abc”,逆序为“cba”,不相同)。输入长度为n的串S,求S的最长双回文子串T,即可将T分为两部分X,Y,(|X|,|Y|≥1)且X和Y都是回文串。Input一行由小写英文字母组成的字符串S。Output一行一...

2017-07-28 15:06:00 104

转载 bzoj 2820 YY的GCD - 莫比乌斯反演 - 线性筛

Description神犇YY虐完数论后给傻×kAc出了一题给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少对kAc这种傻×必然不会了,于是向你来请教……多组输入Input第一行一个整数T 表述数据组数接下来T行,每行两个正整数,表示N, MOutputT行,每行一个...

2017-07-28 10:14:00 119

转载 bzoj 3309 DZY Loves Math - 莫比乌斯反演 - 线性筛

题目传送门  传送门I  传送门II题目大意  定义函数$f(x)$为数$x$所含质因子的最大指数。求$\sum_{i = 1}^{a}\sum_{j = 1}^{b}f((i, j))$。  继续用之前的套路统计每个$f$被计算的次数,然后将gcd化为莫比乌斯函数之和。  $\begin{align} \sum_{i = 1}^{a}\sum_{j ...

2017-07-27 22:42:00 110

转载 Codeforces 808G Anthem of Berland - KMP - 动态规划

题目传送门  传送点I  传送点II  传送点III题目大意  给定一个字符串$s$,和一个字符串$t$,$t$只包含小写字母,$s$包含小写字母和通配符'?'。询问$t$可能在$s$中出现最多多少次。  原来觉得挺神仙,现在觉得还好。  显然用$g_{i}$表示在匹配到第$i$个字符,最多能匹配$t$的次数。  现在讨论它的转移,需要考虑它和...

2017-07-26 17:35:00 174

转载 Codeforces Round #425 (Div. 2) Problem D Misha, Grisha and Underground (Codeforces 832D) - 树链剖分 - 树状...

Misha and Grisha are funny boys, so they like to use new underground. The underground has n stations connected with n - 1 routes so that each route connects two stations, and it is possible t...

2017-07-25 19:53:00 102

转载 Codeforces Round #425 (Div. 2) Problem C Strange Radiation (Codeforces 832C) - 二分答案 - 数论...

npeople are standing on a coordinate axis in points with positive integer coordinates strictly less than106. For each person we know in which direction (left or right) he is facing, and his...

2017-07-25 18:26:00 115

转载 Codeforces Round #425 (Div. 2) Problem B Petya and Exam (Codeforces 832B) - 暴力

It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one.....

2017-07-25 17:59:00 115

转载 Codeforces Round #425 (Div. 2) Problem A Sasha and Sticks (Codeforces 832A)

It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day he invents some game and plays in it alone or with friends.Today he invented one simple ga...

2017-07-25 17:45:00 93

转载 bzoj 2301 Problem b - 莫比乌斯反演

Description对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数。Input第一行一个整数n,接下来n行每行五个整数,分别表示a、b、c、d、kOutput共n行,每行一个整数表示满足要求的数对(x,y)的个数Sampl...

2017-07-24 22:19:00 97

转载 bzoj 1101 [POI2007]Zap - 莫比乌斯反演

Description  FGD正在破解一段密码,他需要回答很多类似的问题:对于给定的整数a,b和d,有多少正整数对x,y,满足x<=a ,y<=b,并且gcd(x,y)=d。作为FGD的同学,FGD希望得到你的帮助。Input  第一行包含一个正整数n,表示一共有n组询问。(1<=n<= 50000)接下来n行,每行表示一个询问,每行...

2017-07-24 21:34:00 117

转载 bzoj 2005 能量采集 - 容斥原理

栋栋有一块长方形的地,他在地上种了一种能量植物,这种植物可以采集太阳光的能量。在这些植物采集能量后,栋栋再使用一个能量汇集机器把这些植物采集到的能量汇集到一起。 栋栋的植物种得非常整齐,一共有n列,每列有m棵,植物的横竖间距都一样,因此对于每一棵植物,栋栋可以用一个坐标(x, y)来表示,其中x的范围是1至n,表示是在第x列,y的范围是1至m,表示是在第x列的第y棵。 由...

2017-07-24 20:23:00 118

转载 bzoj 2527 Meteors - 整体二分 - 树状数组

DescriptionByteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the ...

2017-07-23 15:36:00 112

转载 bzoj 2724 [Violet 6]蒲公英 - 分块

DescriptionInput修正一下l = (l_0 + x - 1) mod n + 1, r = (r_0 + x - 1) mod n + 1OutputSample Input6 3 1 2 3 2 1 2 1 5 3 6 1 5 Sample Output1 2 1 H...

2017-07-21 12:17:00 118

转载 回顾树状数组

  树状数组是一种常用的数据结构,能够在O(log2n)的时间内进行单点修改和求前缀和。因为代码量小、常熟小往往在某些应用中快于线段树(当然有些问题是不能呢用树状数组完成的)。最基本的树状数组  方法1:用一个数组,O(1)修改, O(n)查询  方法2:求前缀和,O(n)修改,O(1)查询  以上两种方法卡一卡就TLE了。  树状数组就平衡了一下这两种方法,修改...

2017-07-20 12:11:00 53

转载 bzoj 3237 连通图 - 并查集 - 线段树

InputOutputSample Input4 51 22 33 44 12 431 52 2 32 1 2Sample OutputConnectedDisconnectedConnectedHintN<=100000 M<=200000 K<=100000  题目大意...

2017-07-18 16:46:00 103

转载 bzoj 2733 永无乡 - 并查集 - 线段树

永无乡包含 n 座岛,编号从 1 到 n,每座岛都有自己的独一无二的重要度,按照重要度可 以将这 n 座岛排名,名次用 1 到 n 来表示。某些岛之间由巨大的桥连接,通过桥可以从一个岛 到达另一个岛。如果从岛 a 出发经过若干座(含 0 座)桥可以到达岛 b,则称岛 a 和岛 b 是连 通的。现在有两种操作:B x y 表示在岛 x 与岛 y 之间修建一座新桥。Q x k 表示询问当...

2017-07-18 11:54:00 85

转载 Codeforces 817C Really Big Numbers - 二分法 - 数论

Ivan likes to learn different things about numbers, but he is especially interested inreally bignumbers. Ivan thinks that a positive integer numberxisreally bigif the difference between...

2017-07-17 15:43:00 158

转载 Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem F (Codeforces 831F) - 数论 - 暴力...

题目传送门  传送门I  传送门II  传送门III题目大意  求一个满足$d\sum_{i = 1}^{n} \left \lceil \frac{a_i}{d} \right \rceil - \sum_{i = 1}^{n} a_{i} \leqslant K$的最大正整数$d$。  整理一下可以得到条件是$d\sum_{i = 1}^{n} \...

2017-07-17 10:35:00 87

转载 浅谈左偏树

( 转载请注明原帖地址http://www.cnblogs.com/yyf0309/p/LeftistTree.html,转载不注明地址必究 )  左偏树是可并堆的一种实现。对比一下普通的堆和左偏树插入取出顶部元素弹出合并普通的堆$O(\log n)$$O(1)$...

2017-07-17 07:59:00 183

转载 SPOJ Meteors - 可持久化线段树 - 二分法

Byteotian Interstellar Union (BIU) has recently discovered a new planet in a nearby galaxy. The planet is unsuitable for colonisation due to strange meteor showers, which on the other hand make...

2017-07-16 16:33:00 156

转载 Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 831D) - 贪心 - 二分答...

There arenpeople andkkeys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the k...

2017-07-16 12:44:00 127

转载 poj 3687 Labeling Balls - 贪心 - 拓扑排序

Windy hasNballs of distinct weights from 1 unit toNunits. Now he tries to label them with 1 toNin such a way that:No two balls share the same label.The labeling satisfies several ...

2017-07-15 22:52:00 106

转载 Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 831E) - 线段树 - 树状...

Vasily has a deck of cards consisting ofncards. There is an integer on each of the cards, this integer is between1and100 000, inclusive. It is possible that some cards have the same inte...

2017-07-14 16:32:00 93

转载 Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 831C) - 暴力 - 二分法...

Polycarp watched TV-show wherekjury members one by one rated a participant by adding him a certain number of points (may be negative, i.e. points were subtracted). Initially the participan...

2017-07-14 16:10:00 91

转载 Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) Problem A - B

Array of integers isunimodal, if:it is strictly increasing in the beginning;after that it is constant;after that it is strictly decreasing.The first block (increasing) and the la...

2017-07-14 16:02:00 88

转载 Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem E (Codeforces 828E) - 分块

Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a sequence of nucleotides. Scientists decided to track evoluti...

2017-07-13 09:30:00 164

转载 Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem D (Codeforces 828D) - 贪心

Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist ofnnodes connected with minimum possible number of wires ...

2017-07-12 17:17:00 106

转载 Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem C (Codeforces 828C) - 链表 - 并查...

Ivan had stringsconsisting of small English letters. However, his friend Julia decided to make fun of him and hid the strings. Ivan preferred making a new string to finding the old one.I...

2017-07-12 17:10:00 119

转载 Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals) Problem A - B

Pronlem AIn a small restaurant there areatables for one person andbtables for two persons.It it known thatngroups of people come today, each consisting of one or two people.If...

2017-07-12 16:56:00 124

转载 2017.7.11 图论测试

  我先用费用流的方法去跑spfa,然后完美T掉6个点。  就说正解吧,正解是跑两次spfa,然后就可以找出最短路覆盖的边(详细过程请看代码rebuild())。然后建图跑最大流Code 1 #include <iostream> 2 #include <cstdio> 3 #include <ctime&gt...

2017-07-12 11:12:00 75

转载 poj 3683 Priest John's Busiest Day - 2-sat

John is the only priest in his town. September 1st is the John's busiest day in a year because there is an old legend in the town that the couple who get married on that day will be forever...

2017-07-11 12:05:00 120

转载 poj 3207 Ikki's Story IV - Panda's Trick - 2-sat

liympanda, one of Ikki’s friend, likes playing games with Ikki. Today after minesweeping with Ikki and winning so many times, he is tired of such easy games and wants to play another game wit...

2017-07-11 09:49:00 102

转载 hdu 1811 Rank of Tetris - 拓扑排序 - 并查集

自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球。为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜,定时更新,名堂要比福布斯富豪榜还响。关于如何排名,这个不用说都知道是根据Rating从高到低来排,如果两个人具有相同的Rating,那就按这几个人的RP从高到低来排。终于,Lele要开始...

2017-07-10 12:06:00 129

空空如也

空空如也

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

TA关注的人

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