- 博客(43)
- 收藏
- 关注
原创 [woj 1551]E - Pairs 2014年武汉大学邀请赛E题 莫队算法
题目大意有n个数,m个查询,对于每个查询,询问指定区间,有多少个数对的绝对值小于等于2。解题思路莫队O^1.5 首先将询问离线处理左端点进行编号,每sqrt(n)个为一组sort结构体 当左端点编号相同时,比较右端点大小。小的放在前面。对于每组询问暴力处理,只需处理当前新加入(删除的数字在当前区间内有多少点和它的绝对值只差小于2即可)唯一要注意的是加点是
2014-12-31 17:37:29
959
原创 [uva 11916]Emoogle Grid 数学 BSGS
11916 - Emoogle GridTime limit: 4.000 secondsYou have to color an M x N ( 1M, N108) two dimensional grid. You will be provided K ( 2K108) different colors to do so. You will also be provided
2014-11-02 16:26:30
960
原创 [hdu 4274]Spy's Work 树形dp
Spy's WorkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1266 Accepted Submission(s): 388Problem DescriptionI'm a manager of
2014-10-31 18:52:56
913
原创 [SPOJ VLATTICE]Visible Lattice Points 数论 莫比乌斯反演
7001. Visible Lattice PointsProblem code: VLATTICEConsider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from co
2014-10-24 09:47:46
1550
原创 [hdu 5072]Coprime 数论-莫比乌斯反演
CoprimeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 142 Accepted Submission(s): 62Problem DescriptionThere are n people
2014-10-23 17:53:19
1635
原创 [zoj 3822]2014牡丹江区域赛 Domination 概率dp求期望
DominationTime Limit: 8 Seconds Memory Limit: 131072 KB Special JudgeEdward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his frie
2014-10-12 20:58:39
1028
原创 [hdu 5051]2014上海网络赛 Fraction 数学 Benford's law/打表找规律
FractionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 239 Accepted Submission(s): 55Problem DescriptionGiven a number n, an
2014-09-28 19:06:59
1290
原创 [hdu 5032]2014北京网络赛Always Cook Mushroom 离线线段树/树状数组
Always Cook MushroomTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 196 Accepted Submission(s): 54Problem DescriptionMatt ha
2014-09-24 09:54:54
1844
原创 [Topcoder]SRM632 div2 题解
TC第一次解出三题……当了次room leader……感觉这次的题比较弱,代码量也很小,都是在拼手速了250 RunningAroundPark 题意很好懂,一圈跑道上有N棵树,现给你遇到这些树的顺序,问最少需要多少走圈才能遇到相应的序列直接判断a[i]首先假定走了一圈#include #include #include #include
2014-09-06 09:07:35
1333
原创 [zoj 3802]Easy 2048 Again 状压DP
Easy 2048 AgainTime Limit: 2 Seconds Memory Limit: 65536 KBDark_sun knows that on a single-track road (which means once he passed this area, he cannot come back again), there are some und
2014-09-02 21:23:40
1148
原创 [hdu 4959]Poor Akagi 数论(卢卡斯数,二次域运算,等比数列求和)
Poor AkagiTime Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 131 Accepted Submission(s): 29Problem DescriptionAkagi is not onl
2014-08-21 08:21:56
1707
原创 [hdu 4945]14多校第八场A 2048 状压DP+数论
2048Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 489 Accepted Submission(s): 112Problem DescriptionTeacher Mai is addicted
2014-08-15 13:11:01
1555
原创 [zoj 3626]Treasure Hunt I 树DP
Treasure Hunt ITime Limit: 2 Seconds Memory Limit: 65536 KBAkiba is a dangerous country since a bloodsucker living there. Sometimes the bloodsucker will appear and kill everyone who isn't
2014-08-14 10:10:07
985
原创 [hdu 4933]Miaomiao's Function 数位DP+大数
Miaomiao's FunctionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 79 Accepted Submission(s): 18Problem DescriptionFirstly ,
2014-08-11 14:33:02
1254
原创 [UVa 1642]Magical GCD STL map遍历
1642 Magical GCDThe Magical GCD of a nonempty sequence of positive integers is defined as the product of its lengthand the greatest common divisor of all its elements.Given a sequence (a1, .
2014-08-05 09:02:57
2219
1
原创 [UVa 11440]Help Tomisu 数论 欧拉函数+拓欧逆元
Problem DHelp Mr. Tomisu Input: Standard Input Output: Standard Output After wasting a significant time of his life in problem-setting, Mr. Tomisu is now searching for glory: A glory that
2014-08-04 21:09:03
1358
原创 [hdu 4899]14年多校第四场C Hero meet devil 状压DP
题目大意给定DNA序列长度m和一个DNA(每单位DNA有AGCT 4种可能)片段,求所有和所给序列最长公共子串长度为0~len的DNA数量解题思路在开题的时候以为是数论+组合数学,思路越想越偏……后来CLJ给出超简要的题解……听别人的一种按位压缩的思路,就是枚举到该位置之时LCS所对应的位置,若一一对应则该位为1,否则为0而当我们要处理新的单位DNA时就有一个变换LCS对应的会改变。则我们枚举所有可能的匹配位置并枚举下一位,算出下一个状态对应的LCS所在位置,按位压缩。
2014-08-03 15:51:38
1898
原创 [poj 2417]Discrete Logging 数论 BSGS
Time Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3516 Accepted: 1651DescriptionGiven a prime P, 2 31, an integer B, 2 BL == N (mod P)InputRead severa
2014-07-30 09:43:16
1702
原创 [hdu 4896]14多校J题 Minimal Spanning Tree 打表
Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 77 Accepted Submission(s): 16Problem DescriptionGiven a connected, undirected,
2014-07-29 22:20:56
1425
原创 [poj 2976]Dropping tests 01分数规划
Dropping testsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5992 Accepted: 2076DescriptionIn a certain course, you take n tests. If you get ai out of
2014-07-28 20:49:33
697
原创 [hdu 4869](14年多校I题)Turn the pokers 找规律+拓欧逆元
题目大意给定M张牌,可以翻转N次,每次可以翻转恰好Xi张牌,刚开始牌面全部朝下,问经过N次翻转之后可能产生的扑克序列数(如样例hint)。解题思路现场还是没出……想到dp的思路但复杂度高达N^2.可以观察到,我们最后正面朝上的牌的数量奇偶总是一定的(如1,3,5),因为不同奇偶情况就需要至少多翻一次,但翻动的次数已经固定不能更改。
2014-07-23 08:51:48
1679
原创 [zoj 3774]Power of Fibonacci 数论(二次剩余 拓展欧几里得 等比数列求和)
Power of FibonacciTime Limit: 5 Seconds Memory Limit: 65536 KBIn mathematics, Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers of the following integer sequence
2014-07-19 10:34:30
4289
原创 [POI 2001+2014acm上海邀请赛]Gold Mine/Beam Cannon 线段树+扫描线
Description Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to retire by the end of the year. The Goldmine management would like to reward him in acknowledgment
2014-07-17 08:22:01
2316
原创 [hihocoder 1033]交错和 数位dp/记忆化搜索
#1033 : 交错和时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定一个数 x,设它十进制展从高位到低位上的数位依次是 a0, a1, ..., an - 1,定义交错和函数:f(x) = a0 - a1 + a2 - ... + ( - 1)n - 1an - 1例如:f(3214567) =
2014-07-16 21:50:30
5389
原创 [Codefoces 401D]Roman and Numbers 数位dp
大多数人的写法是进行位压缩,不过那样的话需要2^18*100 的空间,效率比较低,重复状态数较多,处理起来也不方便,这一题是给出了512M的空间。但是如果空间再小一倍,前者的方法就无能为力了。发现有一种对于数位dp来说比较好的状态压缩方式,直接根据数码x出现的次数进行状态压缩。比如说333444,如果用前者的方法压缩就需要2^6=64的空间,而直接按照出现次数压缩就只需要3*3的空间,对于极限数据,利用均值不等式,也差不多只需(ceil(18/10+1)^10)=59049的空间,提高了空间的利用率(原来
2014-07-09 10:09:20
1105
原创 [Codeforces 258B & 259 D]Little Elephant and Elections 数位dp+dfs
题目大意:说七个party选择数字(各不相同)而规定的小象的party选择的数字之中所拥有的数字4和7的个数要比其他六个party拥有的个数之和还要严格多,询问方案数。如m=7时其余的随意选择至少会拥有一个4或7,与题意矛盾,故方案数为0m=8时,7 1 2 3 5 6 8是一种合法方案思路:由于小象的party选到的数字所含4和7的个数至多和m的位数一样多,则枚举小象的party所含4和7的个数,剩余的6个party直接用dfs即可(直接用乘法原理)。而通过数位dp可以算出1~m之中所拥有
2014-07-09 08:43:27
1449
原创 [hdu 4821]String 字符串hash
StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 248 Accepted Submission(s): 83Problem DescriptionGiven a string S and t
2014-07-06 08:39:24
1125
原创 [Codefoces 251C & 252E]Number Transformation dp+循环节
http://codeforces.com/problemset/problem/252/ENumber Transformationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard o
2014-07-04 13:53:20
814
原创 [poj 1830]开关问题 高斯消元+自由变量枚举
开关问题Time Limit: 1000MS Memory Limit: 30000KTotal Submissions: 5407 Accepted: 2015Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系
2014-07-02 10:00:35
1285
原创 [hdu 1071]The area 高斯消元
7月22-8月21多校联合训练期间,会根据实际负载关闭部分模块,若有不便,请谅解~The areaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7352 Accepted Submission(s):
2014-06-30 08:23:56
815
原创 [hdu 4611]Balls Rearrangement 数论
Balls RearrangementTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2376 Accepted Submission(s): 864Problem Description Bob h
2014-06-24 18:30:55
755
原创 [ZOJ 3633]Alice's present 离线分块/线段树
A - Alice's presentTime Limit:5000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluAs a doll master, Alice owns a wide range of dolls, and each of them has a number tip on it's b
2014-06-12 00:07:33
696
原创 [hdu 4828]Grids 数论(扩展欧几里得求逆元)
#include#include#include#include#include#include#define ll __int64using namespace std;ll q[1000005],ca;int cnt,n,m,t,qq;void egcd(int a,int b,int &x,int &y){ if(b==0) { x=1,y=0;
2014-06-04 12:47:07
976
原创 [poj 3601]Tower of Hanoi 数论
http://poj.org/problem?id=3601DescriptionThe Tower of Hanoi is a puzzle consisting of three pegs and a number of disks of different sizes which can slide onto any peg. The puzzle starts with t
2014-05-31 10:41:08
1453
2
原创 [hdu 4815]Little Tiger vs. Deep Monkey 01背包
http://acm.hdu.edu.cn/showproblem.php?pid=4815
2014-05-26 09:51:41
848
原创 [GCJ14 R1A Problem A]Charging Chaos 位运算+矩阵
ProblemA permutation of size N is a sequence of N numbers, each between 0 andN-1, where each number appears exactly once. They may appear in any order.There are many (N factorial, to be precise,
2014-04-26 13:07:32
1057
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人