#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node
{
int first;
int second;
int id;
}stu[1000];
bool cmp(node X,node Y)
{
if(X.first-X.second!=Y.first-Y.second)
{
return X.first-X.second>Y.first-Y.second;
}
else if(X.second!=Y.second)
return X.second<Y.second;
return X.id<Y.id;
}
int main()
{
int n,i;
while(~scanf("%d",&n))
{
for(i=1;i<=n;i++)
{
scanf("%d %d",&stu[i].first,&stu[i].second);
stu[i].id=i;
}
sort(stu+1,stu+n+1,cmp);
printf("%d",stu[1].id-1);
for(i=2;i<=n;i++)
printf(" %d",stu[i].id-1);
printf("\n");
}
return 0;
}
杭电5182
最新推荐文章于 2019-03-29 11:18:07 发布