SPOJ MEOWIST
The Problem
This problem should be a practise problem
It took me 20mins to solve it =) , I am too rusted lately but hopefully I will post a new problem everyday from now on
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
using namespace std;
class person{
public:
int age;
string name;
person(int a,string b){age=a; name=b;}
};
bool operator< (person a,person b)
{
if(a.age>b.age) return true;
else if(a.age==b.age && a.name<b.name) return true;
return false;
}
int main()
{
string a;
int b;
multiset< person > people;
while(cin>>a>>b)
{
person n(b,a);
people.insert(n);
}
while(people.size())
{
cout<<people.begin()->name<<endl;
people.erase(people.begin());
}
return 0;
}

20 minutes? it took me just 3 seconds :D