-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10814.cpp
More file actions
40 lines (35 loc) · 700 Bytes
/
10814.cpp
File metadata and controls
40 lines (35 loc) · 700 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
40
/*
[10814] 나이순 정렬
https://www.acmicpc.net/problem/10814
https://github.com/tjdskaqks
http://jcoder1.tistory.com/
*/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(pair<int, string> v1, pair<int, string> v2)
{
if (v1.first < v2.first)
return true;
else if (v1.first == v2.first)
return false;
return false;
}
int main()
{
int n, j;
vector< pair<int, string> > v;
cin >> n;
for (j = 0; j < n; j++)
{
int age;
string name;
cin >> age >> name;
v.push_back(make_pair(age, name));
}
stable_sort(v.begin(), v.end(), cmp);
for (j = 0; j < n; j++)
cout << v[j].first << " " << v[j].second << "\n";
}