#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(pair<int, int>a, pair<int, int>b) {
if (a.second != b.second) return a.second < b.second;
else return a.first < b.first;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N; cin >> N;
vector<pair<int, int>>v;
while (N--) {
int x, y; cin >> x >> y;
v.push_back({ x,y });
}
sort(v.begin(), v.end(), cmp);
for (int i = 0; i < v.size(); i++) {
cout << v[i].first << ' ' << v[i].second << "\n";
}
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 11659๋ฒ - ๊ตฌ๊ฐ ํฉ ๊ตฌํ๊ธฐ4 (0) | 2021.10.31 |
---|---|
[๋ฐฑ์ค,c++] 11656๋ฒ - ์ ๋ฏธ์ฌ ๋ฐฐ์ด (0) | 2021.10.31 |
[๋ฐฑ์ค,c++] 11652๋ฒ - ์นด๋ (0) | 2021.10.31 |
[๋ฐฑ์ค,c++] 11650๋ฒ - ์ขํ ์ ๋ ฌํ๊ธฐ (0) | 2021.10.28 |
[๋ฐฑ์ค,c++] 1159๋ฒ - ๋๊ตฌ ๊ฒฝ๊ธฐ (0) | 2021.10.28 |
[๋ฐฑ์ค,c++] 1157๋ฒ - ๋จ์ด ๊ณต๋ถ (0) | 2021.10.28 |
๋๊ธ