-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6-3.cpp
More file actions
44 lines (36 loc) · 750 Bytes
/
6-3.cpp
File metadata and controls
44 lines (36 loc) · 750 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
41
42
43
44
/**
* @file 6-3.cpp
* @brief 성적이 낮은 순서로 학생 출력하기
* @author Sam Kim (samkim2626@gmail.com)
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
bool compare(pair<string, int> a, pair<string, int> b)
{
return a.second < b.second;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<pair<string, int>> v;
for (int i = 0; i < n; i++)
{
string name;
int score;
cin >> name >> score;
v.push_back(make_pair(name, score));
}
sort(v.begin(), v.end(), compare);
for (auto &i : v)
{
cout << i.first << ' ';
}
return 0;
}