//给我一个理由。为何Wrong Answer?
//有高手没 ,帮偶看一个程序(zju 1108)
//http://acm.zju.edu.cn/show_problem.php?pid=1108
//#include "stdafx.h"
#include <iostream>
#include <algorithm>
using namespace std;
struct FatMouse
{
int weight;
int speed;
int sub;
};
FatMouse fat[1001];
short b[1001]; // 记录到i最长串的前一个下标
bool cmp(FatMouse a, FatMouse b)
{
if(a.weight == b.weight)
return a.speed > b.speed;
else
return a.weight < b.weight;
}
void Print(int max, int sub)
{
if(max > 1)
Print(max-1, b[sub]);
cout << fat[sub].sub << endl;
}
int main()
{
int i = 1, j;
short a[1001]; // 记录到i个为止最长的个数;
while(scanf("%d %d", &fat[i].weight , &fat[i].speed) != EOF)
{
fat[i].sub = i;
i++;
}
int N = i;
for(i = 1; i < N; i++)
{
a[i] = 1;
b[i] = i; // 记录到i最长串的前一个下标 ,初始化为自身。
}
sort(fat+1, fat+N, cmp);
for(i = 1; i < N; i++)
{
int temp = -1;
for(j = 1; j <i; j++)
if(fat[i].speed < fat[j].speed && fat[i].weight != fat[j].weight && temp < a[j])
{
temp = a[j];
a[i] = temp+1;
b[i] = j;
}
}
int max = 0, sub;
for(i = 1; i < N; i++)
if(max < b[i])
{
sub = i;
max = b[i];
}
cout << max << endl;
Print(max, sub);
//system("pause");
return 0;
}