-
정렬_백준_좌표 정렬하기_11651Algorithm 2018. 8. 21. 13:581234567891011121314151617181920212223242526272829303132#include <iostream>#include <algorithm>#include <vector>using namespace std;struct Point {int x, y;};bool cmp(const Point & u, const Point & v) {if (u.y < v.y) {return true;}else if (u.y == v.y) {if (u.x < v.x) {return true;}}return false;}int main() {int n;cin >> n;vector <Point> value(n);for (int i = 0; i < n; i++) {scanf("%d %d", &value[i].x, &value[i].y);}sort(value.begin(), value.end(), cmp);for (int i = 0; i < n; i++) {printf("%d %d\n", value[i].x, value[i].y);}}
cs 'Algorithm' 카테고리의 다른 글
정렬_백준_국영수_10825 (0) 2018.08.21 정렬_백준_나이순 정렬_10814 (0) 2018.08.21 정렬_백준_좌표 정렬하기_11650 (0) 2018.08.21 정렬_백준 (0) 2018.08.21 수학_백준_조합 0의 개수_2004 (0) 2018.08.21