#include<bits/stdc++.h>
using namespace std;
#define MAXN 1010
struct s{
int f;
int v;
int id;
}m[MAXN];
bool cmp(s a,s b){
return a.v>b.v;
}
int f,v,dp[MAXN],pre[MAXN];
int main()
{
int count=0,p,len=0;
while(scanf("%d %d",&m[count+1].f,&m[count+1].v)==2){
count++;
m[count].id=count;
}
sort(m+1,m+count+1,cmp);//速度降序排列
memset(dp,0,sizeof dp);
memset(pre,0,sizeof pre);
for(int i=1;i<=count;++i){
for(int j=0;j<i;++j){
if(m[i].f>m[j].f&&dp[i]<dp[j]+1){
pre[i]=j;
dp[i]=dp[j]+1;
}
}
}
for(int i=1;i<=count;++i){
if(len<dp[i]) {
len=dp[i];
p=i;
}
}
printf("%d\n",len);
count=len;
while(p!=0){
dp[count--]=m[p].id;
p=pre[p];
}
for(int i=1;i<=len;++i)
printf("%d\n",dp[i]);
return 0;
}
06-02
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交