- 博客(212)
- 收藏
- 关注
原创 poj3150 && LA3704 Cellular Automaton 矩阵乘法 + 循环矩阵性质
Language:DefaultCellular AutomatonTime Limit: 12000MS Memory Limit: 65536KTotal Submissions: 3042 Accepted: 1225Case Time Limit: 2000MSDescriptionA
2014-07-03 22:56:59 1058
原创 poj1681 Painter's Problem 高斯消元
Language:DefaultPainter's ProblemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4398 Accepted: 2134DescriptionThere is a square wall which is mad
2014-07-03 09:15:50 768
原创 uva10870 Recurrences 矩阵快速幂
Problem ARecurrencesInput: standard inputOutput: standard outputConsider recurrent functions of the following form:f(n) = a1 f(n - 1) + a2 f(n - 2) + a3 f(n - 3) + ... + ad f(n - d), f
2014-07-02 17:57:35 672
原创 poj1222 EXTENDED LIGHTS OUT 高斯消元
Language:DefaultEXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6409 Accepted: 4207DescriptionIn an extended version of the gam
2014-07-02 14:48:00 685
原创 poj1986 Distance Queries 离线LCA
Language:DefaultDistance QueriesTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 8740 Accepted: 3065Case Time Limit: 1000MSDescriptionFarmer
2014-07-01 22:59:55 711
原创 poj3728 The merchant LCA+RMQ或 LCA+b并查集 好题!
Language:DefaultThe merchantTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 3020 Accepted: 999DescriptionThere are N cities in a country, and ther
2014-07-01 14:23:19 597
原创 poj1470 Closest Common Ancestors 离线LCA
Language:DefaultClosest Common AncestorsTime Limit: 2000MS Memory Limit: 10000KTotal Submissions: 14915 Accepted: 4745DescriptionWrite a program that takes
2014-06-29 11:17:36 910
原创 poj1330 Nearest Common Ancestors LCA倍增法 或 LCA转RMQ
Language:DefaultNearest Common AncestorsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 17123 Accepted: 9115DescriptionA rooted tree is a well-kno
2014-06-28 15:15:50 847
原创 zoj3527
Shinryaku! Kero MusumeTime Limit: 4 Seconds Memory Limit: 65536 KB2300 years ago, Moriya Suwako was defeated by Yasaka Kanako in the Great Suwa War. As the goddess of mountains in Gensoky
2014-06-05 00:33:17 766
原创 codeforces round #250 div1
A. The Child and Toytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn Children's Day, the child got a toy
2014-06-04 00:19:30 1175
原创 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 787
原创 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
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人