码迷,mamicode.com
首页 >  
搜索关键字:poj 单调栈    ( 20976个结果
POJ 2355 Railway tickets (线性dp)
OJ题目 : click here~ 题目分析:X为距离 , 当0C1。 L1C2。L2 设dp[ i ] 为到车站 i 的最少票价 。 则转移方程为dp[ i ] = min(dp[ j ] + 从j 到 i 的票价),j 为所有可以直接到 i 的车站。 要注意第一个数字 大于 第二个数字的情况。的确,题目没有说,从a 到 b。只说了a,b之间。要仔细读题啊,不能想当然。 AC_COD...
分类:其他好文   时间:2014-07-22 23:05:52    阅读次数:294
POJ 3882 Stammering Aliens 后缀数组height应用
题目来源:POJ 3882 Stammering Aliens 题意:给你m一个一个字符串 求至少出现m次的最长字符串 可以在字符串中重叠出现 思路:二分长度l 然后从height数组中找长度大于等于l的前缀 #include #include #include using namespace std; const int maxn = 40010; char s[maxn]; in...
分类:其他好文   时间:2014-05-01 17:36:34    阅读次数:334
POJ - 2926 Requirements
题意:多维的曼哈顿最远距离 思路:做了1,2,3维的,其实就是枚举所有绝对值的可能的表达式 #include #include #include #include using namespace std; const int MAXN = 100005; const int M = 5; const double inf = 1e200; struct node{ double x...
分类:其他好文   时间:2014-05-01 17:31:01    阅读次数:283
poj 3617 Best Cow Line(贪心)
?? Best Cow Line Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8579   Accepted: 2629 Description FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the a...
分类:其他好文   时间:2014-04-29 13:48:21    阅读次数:358
poj 2823 Sliding Window
Sliding Window Time Limit: 12000MS   Memory Limit: 65536K Total Submissions: 36147   Accepted: 10700 Case Time Limit: 5000MS Description An array of size n ≤ 106 i...
分类:Windows程序   时间:2014-04-29 13:45:21    阅读次数:503
[ACM] poj 1064 Cable master (二分查找)
Cable master Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21071   Accepted: 4542 Description Inhabitants of the Wonderland have decided to hold a regional p...
分类:其他好文   时间:2014-04-29 13:44:22    阅读次数:360
状态压缩dp入门 (poj3254 Corn Fields)
题目链接:http://poj.org/problem?id=3254 题意:给出一个n行m列的草地,1表示肥沃,0表示贫瘠,现在要把一些牛放在肥沃的草地上,但是要求所有牛不能相邻,问你有多少种放法。 分析:假如我们知道第 i-1 行的所有的可以放的情况,那么对于第 i 行的可以放的一种情况,我们只要判断它和 i - 1 行的所有情况的能不能满足题目的所有牛不相邻,如果有种中满...
分类:其他好文   时间:2014-04-29 13:33:20    阅读次数:242
POJ 2533 Longest Ordered Subsequence 最长上升子序列
最长上升子序列: 有两种基本方法:两个时间复杂度分别为O(n^2)和O(nlogn)。 O(n^2) 容易的出动态规划的递推公式dp[i]=max(dp[j])+1 j=1,2...i-1,dp[i]是以元素i结尾的最长子序列个数。 在O(n^2)的最长上升子序列中可以通过记录每个元素前缀元素位置的方式来得到整个的最长上升子序列。 代码:int LISOn2(int a[],int to...
分类:其他好文   时间:2014-04-29 13:24:22    阅读次数:314
poj 3069 Saruman's Army(贪心)
?? Saruman's Army Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3446   Accepted: 1752 Description Saruman the White must lead his army along a straight pa...
分类:其他好文   时间:2014-04-29 13:22:23    阅读次数:264
[ACM] poj 2456 Aggressive cows (二分查找)
Aggressive cows Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5436   Accepted: 2720 Description Farmer John has built a new long barn, with N (2 <= N <= 100,...
分类:其他好文   时间:2014-04-29 13:22:21    阅读次数:304
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!