http://acm.hdu.edu.cn/showproblem.php?pid=1160 FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12338    Accepted Submission(s): 5405Special Judge Problem Description FatMouse be…
传送门: ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=108 HDU :http://acm.hdu.edu.cn/showproblem.php?pid=1160 题目大意: 输入好多组w 和 s 代表老鼠的重量和速度,要求找出满足 w 严格 升序, s严格降序的最大长度和他们的序号. 我是先排序,然后和ZOJ 1136 Longest Ordered Subsequence (http://blog.csdn.…
#include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; struct node { int w, s; int index; //储存标号 } mouse[]; //小鼠的信息 //先体重,后速度 bool cmp(node a,node b) { if(a.w==b.w) return a.s<b.s; return a…
参考:https://blog.csdn.net/u012655441/article/details/64920825 https://blog.csdn.net/wy19910326/article/details/7232308 https://blog.csdn.net/weizhuwyzc000/article/details/45823031 #include <iostream> #include <cstdio> #include <cstring> #…
HDU - 1160 给一些老鼠的体重和速度 要求对老鼠进行重排列,并找出一个最长的子序列,体重严格递增,速度严格递减 并输出一种方案 原题等于定义一个偏序关系 $(a,b)<(c.d)$ 当且仅当 $a<c,b>d$ 然后找出最长链 ...我们就按照他说的重新排个序,然后找LIS吧,不过还需要去路径还原 数据量可以用$O(n^2)$的算法 不过我这里用来$O(nlogn)$的算法加上一个路径还原 嗯,其实是在一个单调栈上乱搞的二分罢了.... 最后要回溯一下并且记录答案才行 #incl…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24573    Accepted Submission(s): 10896Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 14980    Accepted Submission(s): 6618 Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster…
FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20803    Accepted Submission(s): 9227Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster…
题意  输入n个老鼠的体重和速度   从里面找出最长的序列  是的重量递增时速度递减 简单的DP  令d[i]表示以第i个老鼠为所求序列最后一个时序列的长度  对与每一个老鼠i  遍历全部老鼠j  当(w[i] > w[j]) && (s[i] < s[j])时  有d[i]=max(d[i],d[j]+1)  输出路径记下最后一个递归即可了 #include<cstdio> #include<algorithm> using namespace std…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13133    Accepted Submission(s): 5778Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster i…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7213    Accepted Submission(s): 3181Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster it…
G - FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description: Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you…
FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description:  prayerhgq  (2015-07-28) System Crawler  (2015-09-05) Description FatMouse believes that the fatter a m…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1160 FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20100    Accepted Submission(s): 8909Special Judge Problem Description FatMou…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1160 FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17386    Accepted Submission(s): 7694Special Judge Problem Description…
J. FatMouse's Speed FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence so that the weights are incre…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13643    Accepted Submission(s): 6011Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster i…
FatMouse's Speed Time Limit: 2 Seconds      Memory Limit:65536 KB     Special Judge FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of thi…
p的思路不一定要到最后去找到ans:也可以设置成在中间找到ans:比如J - FatMouse's Speed 这个题,如果要是让dp[n]成为最终答案的话,即到了i,最差的情况也是dp[i-1],就很难去保存路径,但是如果换一个思路,让dp[i]必须去参与,如果无法与前面的结合,那么就新开一个. 最后路径是保存的逆序的,那么开一个stack就可以解决. //显然这个题是要维护两个变量的最长上升子序列 #include <iostream> #include <fstream> #…
FatMouse's Speed Time Limit: 2 Seconds      Memory Limit:65536 KB     Special Judge FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of thi…
J - FatMouse's Speed DP的题写得多了慢慢也有了思路,虽然也还只是很简单的DP. 因为需要输出所有选择的老鼠,所以刚开始的时候想利用状态压缩来储存所选择的老鼠,后面才发现n太大1<<1000根本存不下来... 思路的话其实也不难,把体重排序之后,对速度求一个最长下降子序列即可. 对于每一次求最长有序子序列,只需要全部遍历一遍,遍历的时候,将该位置作为所选择序列的最后一个元素,DP[i]即为该序列的最大长度. 代码: // Created by CAD on 2019/10/…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23350    Accepted Submission(s): 10391Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster…
题目大意:输入数据直到文件结束,每行两个数据 体重M 和 速度V,将其排列得到一个序列,要求为:体重越大 速度越低(相等则不符合条件).求这种序列最长的长度,并输出路径.答案不唯一,输出任意一种就好了. 题目思路:这是个最长上升子序列的问题,我们按W的升序进行排序,若W相等则按V的降序排序.用Pre[]记录当前点的前驱节点,Last记录序列最后一个点,maxn记录最长长度,完成动规后可根据Last和Pre[]输出路径. #include<cstdio> #include<stdio.h&…
      #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; #define met(a,b) (memset(a,b,sizeof(a))) #define N 1100 #define INF 0xffffff struct node { int w, s, nu…
动态规划的解决方法是找到动态转移方程. 题目地址:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=3&sectionid=2&problemid=4 题目大意:找到一个最多的老鼠序列,使得序列中的老鼠的体重满足递增,相应老鼠的速度满足递 减.即可要求找出老鼠体重递增,速度递减的最长子序列(不需要连续). 思路:动态转移方程的确定,状态f[i]表示前i个老鼠中的最长递减子序列长度,状态转移方程为mouse[i].len…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 题目意思:给出一堆老鼠,假设有 n 只(输入n条信息后Ctrl+Z).每只老鼠有对应的weight 和 speed.现在需要从这 n 只老鼠的序列中,找出最长的一条序列,满足老鼠的weight严格递增,speed严格递减. 我们可以用一个结构体来保存老鼠的信息,包括weight, speed 以及 id(这个 id 是未排序之前的,为了输出最后信息).那么首先对 weight 进行递增排序,如…
http://acm.hdu.edu.cn/showproblem.php?pid=1160 同样是先按它的体重由小到大排,相同就按speed排就行. 这样做的好处是,能用O(n^2)枚举,因为前面的肯定不能和后面的搭配了. 然后就是LIS的题了, #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> #defin…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1160 给你一些老鼠的体重和速度,问你最多需要几只可以证明体重越重速度越慢,并输出任意一组答案. 结构体按照体重从小到大排序,然后根据速度就是最长下降子序列. //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm> #include <iostream> #includ…
Problem Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence so that the weights are incre…