-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10814.cpp
More file actions
39 lines (37 loc) · 726 Bytes
/
10814.cpp
File metadata and controls
39 lines (37 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
struct P{
int age;
string name;
bool operator <(const P &b) const{
return this->age < b.age;
}
};
vector< pair<P,int> >v;
int main(int argc, char** argv)
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
vector< pair<int,string> >pv;
int n,a;
string b;
cin>>n;
for (int i = 0; i < n; ++i)
{
cin>>a>>b;
P p;
p.age = a;
p.name = b;
v.push_back(make_pair(p,i));
}
sort(v.begin(),v.end());
for (int i = 0; i < n; ++i)
{
cout<<v[i].first.age<<" "<<v[i].first.name<<"\n";
}
return 0;
}