#include<bits/stdc++.h>
using namespace std;

struct stu
{
	int yuwen;
	int shuxue;
	int xuehao;
} a[99999];

//bool cmp(stu a,stu b)
//{
//	return a.yuwen>b.yuwen;
//}

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		cin >> a[i].yuwen >> a[i].shuxue;
		a[i].xuehao=i+1;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(a[i].yuwen>a[j].yuwen)
				swap(a[i],a[j]);
			if(a[i].yuwen==a[j].yuwen&&a[i].shuxue>a[j].shuxue)
				swap(a[i],a[j]);
			if(a[i].yuwen==a[j].yuwen&&a[i].shuxue==a[j].shuxue&&a[i].xuehao>a[j].xuehao)
			{
				swap(a[i],a[j]);
			}
		}
	}
	for(int i=0;i<n;i++)
	{
		cout << a[i].xuehao << ' ';	
	}
	
	return 0;
}

0 comments

No comments so far...

Information

ID
694
Time
1000ms
Memory
256MiB
Difficulty
7
Tags
# Submissions
18
Accepted
10
Uploaded By