문제 :

https://www.acmicpc.net/problem/11651

 

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<pair<int, int>> v;
int main(void)
{
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int cnt;
cin >> cnt;
for (int i = 1; i <= cnt; i++) {
int x, y;
cin >> x >> y;
v.push_back(make_pair(y, x));
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size(); i++) {
cout << v[i].second << ' ' << v[i].first << '\n';
}
return 0;
}
view raw 11651.cpp hosted with ❤ by GitHub

'문제풀이 > 백준' 카테고리의 다른 글

10026 - 적록색약  (0) 2022.04.23
2163 - 초콜릿 자르기  (0) 2022.04.23
7579 - 앱  (0) 2022.04.23
7576 - 토마토  (0) 2022.04.23
1541 - 잃어버린 괄호  (0) 2022.04.23

+ Recent posts