解题报告 之 HDU5301 Buildings
Description
Your current task is to make a ground plan for a residential building located in HZXJHS. So you must determine a way to split the floor building with walls to make apartments in the shape of a rectangle. Each built wal...
分类:
其他好文 时间:
2015-08-19 01:59:54
阅读次数:
146
1.题目描述:点击打开链接
2.解题思路:本题利用扫描法解决。根据题意描述,[L,i)和[i,R)区间都构成了等差数列,因此可以实现用L[i],R[i]来维护从i开始向左向右可以延伸的最远长度,如果d1和d2不等,那么答案就是L[i]*R[i]求和,否则就是R[i]求和。
3.代码:
//#pragma comment(linker, "/STACK:1024000000,102400000...
分类:
其他好文 时间:
2015-08-19 00:42:44
阅读次数:
161
解题报告 之 CodeForces 6E Exposition
Description
There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writ...
分类:
其他好文 时间:
2015-08-19 00:35:45
阅读次数:
223
HDU 5402 Travelling Salesman Problem(棋盘染色 构造 多校啊)...
分类:
其他好文 时间:
2015-08-18 22:55:28
阅读次数:
336
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5400这题其实就是求有多少公差为d1和公差为d2的等差序列和前半段是公差为d1后半段的公差为d2的序列。。。。。我们可以用个b数组保存序列中相邻两项的和,然后直接查找b数组的值是否等于d1或d2。再来进行...
分类:
其他好文 时间:
2015-08-18 22:35:13
阅读次数:
149
题目链接:点击打开链接
题目大意:有m个映射,从1到n映射到1到n,记为f1,f2,f3,,,fm,并且这些映射满足f1( f2( f3(,,,,fm(i) ) ) ) = i现在已知几个映射的值,还有几个映射是不知道的,问不知道的映射一共有几种可能的组合方式。
输入n m,之后m行,如果一行的第一个数为-1,代表这一个映射fi是不知道的,否则一行有n个数,第i行的第j个数字x代表fi(j)...
分类:
其他好文 时间:
2015-08-18 21:28:03
阅读次数:
130
1.题目描述:点击打开链接
2.解题思路:本题分情况讨论。比赛时候真是想的太简单了,以为就是(n!)^(cnt-1)。最终无限WA。本题有几个特殊情况需要额外判断。首先,如果输入的时候,有某一行不是-1且有两个数映射到同一个数,那么必然无解,ans=0。其次,如果不存在-1,需要从第m个函数一步步映射到第1个函数,检查一下最后是否真的变成了自身映射。最容易想到的情况就是有至少一个-1,那么最后答...
分类:
其他好文 时间:
2015-08-18 21:26:14
阅读次数:
139
Arithmetic Sequence
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 0 Accepted Submission(s): 0
Problem Description
A sequence b...
分类:
其他好文 时间:
2015-08-18 19:33:25
阅读次数:
147
Problem Description
There are n people
and m pairs
of friends. For every pair of friends, they can choose to become online friends (communicating using online applications) or offline friends (...
分类:
其他好文 时间:
2015-08-17 19:34:53
阅读次数:
114
题目链接:点击打开链接
题目大意:f(l,r)=∑ri=l∑rj=igcd(ai,ai+1....aj),给出初始的n个值,q次询问,每次询问输出f(l,r)的值
大多都是说莫队算法,没有想出肿么用,,,,本题用两个线段树完成
首先对于任意一个a[i],每次gcd减小至少一半,所以它向后的gcd最多下降log(a[i])次,可以求出对于每一个a[i]来说的gcd相同的各个区间。
用线段树...
分类:
其他好文 时间:
2015-08-17 15:34:27
阅读次数:
134