-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10814.cpp
More file actions
61 lines (48 loc) · 895 Bytes
/
10814.cpp
File metadata and controls
61 lines (48 loc) · 895 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// 10814.cpp
// algo
//
// Created by 박효정 on 2021/04/28.
//
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct s{
int age;
string name;
int index;
s(int a,string b,int cn){
age=a;
name=b;
index=cn;
}
//오름차순
bool operator <(const s &b) const{
if(age!=b.age){
return age<b.age;
}
else{
return index<b.index;
}
}
};
int main(){
cin.tie(0);
cout.tie(0);
std::ios::sync_with_stdio(false);
int n;
cin>>n;
vector<s> v;
int age;
string name;
for(int i=0;i<n;i++){
cin>>age>>name;
v.push_back(s(age,name,i));
}
sort(v.begin(), v.end());
for(int i=0;i<n;i++){
cout<<v[i].age<<' '<<v[i].name<<"\n";
}
return 0;
}