码迷,mamicode.com
首页 >  
搜索关键字:gty    ( 297个结果
hdu 5171 GTY's birthday gift(数学,矩阵快速幂)
题意:开始时集合中有n个数。现在要进行k次操作。每次操作:从集合中挑最大的两个数a,b进行相加,得到的数添加进集合中。以此反复k次。问最后集合中所有数的和是多少。(2≤n≤100000,1≤k≤1000000000)思路:写出来发现是要求Fibonaci的前n个数的和。Fibonaci是用矩阵快速幂...
分类:其他好文   时间:2015-03-02 22:22:23    阅读次数:210
hdu 5172 GTY's gay friends(线段树最值)
题意:GTY有n个朋友,站成一排,每个人有一个特征值ai。有m个询问。每次询问给两个数L,R。问你[L,R](即aL...aR)是否是1..(R-L+1)的一个全排列。是输出YES,否则输出NO思路:先判断是否segma(a[L,R])是否等于(R-L)*(R-L+1)/2。记录每一个ai上一次的位...
分类:其他好文   时间:2015-03-02 22:15:18    阅读次数:175
HDU5171 GTY's birthday gift(矩阵快速幂)
Problem Description FFZ's birthday is coming. GTY wants to give a gift to ZZF. He asked his gay friends what he should give to ZZF. One of them said, 'Nothing is more interesting than a number multis...
分类:其他好文   时间:2015-02-19 18:43:02    阅读次数:219
HDU 5172 GTY's gay friends 线段树
GTY's gay friendsTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) 【Problem Description】GTY has n gay friends. To manage...
分类:其他好文   时间:2015-02-16 18:06:23    阅读次数:250
HDU 5171 GTY's birthday gift(矩阵快速幂 )
HDU 5171 GTY's birthday gift ( 矩阵快速幂裸题目 )#include #include #include using namespace std;#define MAX_SIZE 3#define MOD 10000007#define clr( a, b ) ...
分类:其他好文   时间:2015-02-15 17:49:06    阅读次数:126
hdu5172---GTY's gay friends
Problem Description GTY has n gay friends. To manage them conveniently, every morning he ordered all his gay friends to stand in a line. Every gay friend has a characteristic value ai , to express how...
分类:其他好文   时间:2015-02-14 13:47:38    阅读次数:246
hdu5171---GTY's birthday gift
Problem Description FFZ’s birthday is coming. GTY wants to give a gift to ZZF. He asked his gay friends what he should give to ZZF. One of them said, ‘Nothing is more interesting than a number multise...
分类:其他好文   时间:2015-02-14 12:20:03    阅读次数:160
hdu 5172 GTY's gay friends
hdu 5172 GTY's gay friends 题意: 给出n个数, a[1],a[2],...a[n], m个询问, 对于每个询问[l,r], 问a[l],a[l+1],...,a[r]是不是集合{1,2,...,r-l+1} 限制: 1 思路: 预处理出,对于每个位置,它前一个相同的数对的位置。 如: 给出的数组:            1  2 1 2 3 预处...
分类:其他好文   时间:2015-02-13 18:38:41    阅读次数:200
HDU 5172 GTY's gay friends (线段树)
题目地址:HDU 5172 比赛的时候用一个维护了区间和,区间积,区间最值的线段树水过去了。。赛后数据改回10^6后,就TLE了。。 正解是区间和用前缀和维护就可以。然后维护一个该位上的数上一个出现额位置,那么每次查询,如果每个数的上一个出现的位置都小于l的话,那么就说明没有重复的,如果区间和符合全排列的和,那么就说明肯定是一个全排列了。 代码如下: #include #include ...
分类:其他好文   时间:2015-02-11 16:37:51    阅读次数:150
HDU 5172 GTY's gay friends (预处理+线段树)
题目链接:HDU 5172 GTY's gay friends 题意:给出一串序列,询问[l,r]区间里是否存在1~l-r+1的一个排列。 思路:1~l-r+1的一个排列 等价于 [l,r]中元素互不相同且[l,r]区间和等于(1+len)*len/2(len=l-r+1)。 区间和可以用前缀和来处理。 元素互不相同,记录位置i上a[i]上次出现的位置记做pre[i],再用线段树来维护区间...
分类:其他好文   时间:2015-02-10 16:50:48    阅读次数:186
297条   上一页 1 ... 24 25 26 27 28 ... 30 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!