- 博客(39)
- 收藏
- 关注
原创 poj 2406 Power Strings kmp
Language:DefaultPower StringsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 30779 Accepted: 12821DescriptionGiven two strings a and b we define a
2014-05-31 20:18:26 898
原创 hdu3853 LOOPS 概率dp求期望
题意:给定一个n*m的方格,给出相应( i , j ) 原地、往下 、往右走的概率,每走一格花费魔法值2,求从起始点(1,1)到(n,m)花费魔法值的期望思路:设dp[ i ][ j ]为从(i , j)出发到达目标状态(n , m)所需魔法值的期望。dp[ i ][ j ]有3种转移方式:(1)dp[ i ][ j ] -------> dp[ i ][ j ],转移概率为p1;(2
2014-05-30 22:09:10 1184
原创 poj 2778 DNA Sequence ac机+矩阵快速幂
题意:给定m个仅由A、C、G、T构成的非法串,问仅由A、C、G、T构成的长度为n的字符串共有多少个。思路:先用ac自动机求出初始矩阵,初始矩阵A.matrix[i][j]表示从自动机的节点i走一步不经过熟悉串的结尾有几种方法可以走到节点j,然后用对A.matrix矩阵进行二分快速幂求A^L,其中A.matrix[i][j]表示从i到j经过L步不经过熟悉串的结尾的方法数。我们又注意到对于自动机节
2014-05-30 17:20:11 903
原创 hdu 4586 Play the Dice 2013南京邀请赛A 概率dp求期望
题意:有一个n面的骰子,掷到第i面,可得a[i]分。其中有m个面,可获得再掷一次的机会,求掷一次得分的期望。思路:解法1:总期望等于子期望的加权和,加权因子为子期望发生的概率。设所求期望为Exp,因为无限掷,当前状态与转移状态的期望趋于同一极限Exp,Exp有m种转移方式,转移概率均为 1 / n , 即:Exp= 1 / n * ( ( Exp +a [ b[ 1 ] ] ) +
2014-05-30 11:24:47 1133
原创 hdu2457 DNA repair ac机+dp
DNA repairTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1201 Accepted Submission(s): 649Problem DescriptionBiologists final
2014-05-28 15:36:50 1034
原创 poj1625 Censored! 高精度+ac机+dp
Language:DefaultCensored!Time Limit: 5000MS Memory Limit: 10000KTotal Submissions: 7712 Accepted: 2095DescriptionThe alphabet of Freeland consists of exactl
2014-05-28 01:24:28 788
原创 bnuoj34985 Elegant String 2014北京邀请赛E 递推+矩阵快速幂
#include#include#includeusing namespace std;typedef long long ll;const int MAXN=15;const int mod=20140518;ll n;int K;struct Matrix{ ll matrix[MAXN][MAXN];}E;Matrix matrix_mul(Matrix a,M
2014-05-27 22:32:11 846
原创 hdu 4565 So Easy! 递推+矩阵快速幂
So Easy!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2022 Accepted Submission(s): 621Problem Description A sequence Sn is
2014-05-24 22:31:50 883
原创 codeforces300C Beautiful Numbers 乘法逆元
C. Beautiful Numberstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVitaly is a very weird man. He's got t
2014-05-24 18:18:50 1737
原创 ural1297 Palindrome 后缀数组
1297. PalindromeTime limit: 1.0 secondMemory limit: 64 MBThe “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Un
2014-05-23 23:05:39 755
原创 spoj694 Distinct Substrings 后缀数组
SPOJ Problem Set (classical)694. Distinct SubstringsProblem code: DISUBSTR
2014-05-23 01:12:41 741
原创 poj3261Milk Patterns 二分+后缀数组
Language:DefaultMilk PatternsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 9665 Accepted: 4333Case Time Limit: 2000MSDescriptionFarmer Joh
2014-05-23 00:54:55 695
原创 poj1743 Musical Theme 二分+后缀数组
Language:DefaultMusical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 17395 Accepted: 5983DescriptionA musical melody is represented as a s
2014-05-23 00:08:53 746
原创 PKU Campus 2011 B A Problem about Tree lca倍增
题意:n个节点的一棵树,m次询问:求以x为根y的父亲节点。思路:lca倍增算法。利用bfs求出每个节点的深度以及2^i倍祖先。接下来求x和y的lca,如果lca!=y,那么y的父节点就是ancestor[y][0],不然求x的depth[x]-depth[y]-1祖先结点。画图还是比较看粗来的,详见程序:#include#include#include#include#includ
2014-05-15 23:12:43 742
原创 poj1703 Find them, Catch them 种类并查集
Language:DefaultFind them, Catch themTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 29323 Accepted: 9008DescriptionThe police office in Tadu City
2014-05-15 00:18:20 693
原创 poj3017 Cut the Sequence 单调队列优化dp 好题!
Language:DefaultCut the SequenceTime Limit: 2000MS Memory Limit: 131072KTotal Submissions: 8766 Accepted: 2578DescriptionGiven an integer sequence { an } of
2014-05-15 00:11:00 2816 2
原创 poj2492 A Bug's Life 种类并查集
Language:DefaultA Bug's LifeTime Limit: 10000MS Memory Limit: 65536KTotal Submissions: 27157 Accepted: 8841DescriptionBackground Professor Hopper is resea
2014-05-14 17:16:58 897
原创 hdu3415 Max Sum of Max-K-sub-sequence 单调队列
Max Sum of Max-K-sub-sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5692 Accepted Submission(s): 2060Problem Description
2014-05-14 15:46:01 749
原创 hdu3530 Subsequence 单调队列
SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3996 Accepted Submission(s): 1309Problem DescriptionThere is a seq
2014-05-14 14:52:17 811
原创 poj 2823 Sliding Window 单调队列
Language:DefaultSliding WindowTime Limit: 12000MS Memory Limit: 65536KTotal Submissions: 36485 Accepted: 10805Case Time Limit: 5000MSDescriptionAn arr
2014-05-14 00:42:42 740
原创 fzu1894 志愿者选拔 单调队列
Problem 1894 志愿者选拔Accept: 1299 Submit: 4084Time Limit: 1500 mSec Memory Limit : 32768 KB Problem Description世博会马上就要开幕了,福州大学组织了一次志愿者选拔活动。参加志愿者选拔的同学们排队接受面试官们的面试。参加面试的同学们按照先来先面试
2014-05-14 00:08:47 703
原创 zoj2397 Tian Ji -- The Horse Racing 贪心
Tian Ji -- The Horse RacingTime Limit: 5 Seconds Memory Limit: 32768 KBHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in t
2014-05-13 22:43:02 868
原创 poj1182 食物链 种类并查集 经典题
Language:Default食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 42070 Accepted: 12264Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。
2014-05-13 21:30:59 712
原创 poj1442 Black Box treap
给定一组数据按顺序插入,每次在u个元素的时候(本例中(后略)是1,2,6,6),找到第i小的数,i= 1,2,3,4...,
2014-05-13 18:08:18 743
原创 poj 2761 Feed the dogs 离线treap
Language:DefaultFeed the dogsTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 15157 Accepted: 4670DescriptionWind loves pretty dogs very much, and
2014-05-13 15:45:27 973
原创 live archive 3713 two-sat
The Bandulu Space Agency (BSA) has plans for the following three space missions:Mission A: Landing on Ganymede, the largest moon of Jupiter.Mission B: Landing on Callisto, the second largest moo
2014-05-09 00:57:40 737
原创 hdu 2476 String painter 区间dp
String painterTime Limit: 5000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1482 Accepted Submission(s): 644Problem DescriptionThere are tw
2014-05-09 00:22:42 852
原创 codeforces356A Knight Tournament 并查集或线段树成端更新
A. Knight Tournamenttime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHooray! Berl II, the king of Berland i
2014-05-08 23:00:31 1021
原创 poj2955 Brackets 区间dp
Language:DefaultBracketsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2686 Accepted: 1394DescriptionWe give the following inductive definition
2014-05-06 23:30:11 758
原创 poj1651 Multiplication Puzzle 区间dp
Language:DefaultMultiplication PuzzleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5845 Accepted: 3544DescriptionThe multiplication puzzle is pl
2014-05-06 23:16:29 746
原创 zoj3537 cake 区间dp+凸包
CakeTime Limit: 1 Second Memory Limit: 32768 KBYou want to hold a party. Here's a polygon-shaped cake on the table. You'd like to cut the cake into several triangle-shaped parts for the i
2014-05-06 16:21:16 908
原创 poj2411 mondriaan's dream 状压dp
Mondriaan's DreamTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 10925 Accepted: 6356DescriptionSquares and rectangles fascinated the famous Dutch paint
2014-05-06 14:22:46 849
原创 poj3254 Corn Fields 状压dp
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 6539 Accepted: 3482DescriptionFarmer John has purchased a lush new rectangular pasture compos
2014-05-05 20:36:16 772
原创 hdu2896 病毒侵袭 简单ac机
病毒侵袭Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9785 Accepted Submission(s): 2519Problem Description当太阳的光辉逐渐被月亮遮蔽,世界失去了光明
2014-05-05 13:59:59 744
原创 spoj7758 Growing Strings ac机+dp
SPOJ Problem Set (classical)7758. Growing StringsProblem code: MGLAR10 EnglishVietnamese Gene and Gina have a particular ki
2014-05-04 10:15:11 1085
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人