Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Window-Via-c/c++
- 운영체제
- BOJ
- inflearn
- FIFO paging
- Operating System
- HTTP
- 김영한
- C#
- 우아한 테크 세미나
- 스프링 입문
- TCP/IP
- 2475번
- Operating System.
- 이펙티브코틀린
- 스프링 핵심 원리
- 우아한레디스
- OS
- 윤성우 저자
- Spring
- 열혈 TCP/IP 소켓 프로그래밍
- Four Squares
- redis
- 토마토
- 10026번
- n타일링2
- 제프리리처
- C++
- 열혈 tcp/ip 프로그래밍
- 에러핸들링
Archives
- Today
- Total
나의 브을로오그으
[c++] 11650번 : 좌표 정렬하기 본문
https://www.acmicpc.net/problem/11650
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef struct Point {
int x;
int y;
Point(int x, int y) {
this->x = x;
this->y = y;
}
}POINT, *PPOINT;
int compare(POINT p1, POINT p2)
{
return p1.x == p2.x ? p1.y < p2.y : p1.x < p2.x;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
vector<POINT> v;
v.reserve(100000);
int N = 0;
int x, y;
cin >> N;
for (int i = 0; i < N; ++i)
{
cin >> x >> y;
POINT point(x, y);
v.push_back(point);
}
sort(begin(v), end(v), compare);
for (int i = 0; i < N; ++i)
{
cout << v[i].x << ' ' << v[i].y << '\n';
}
return 0;
}
'알고리즘 > BaekJoon' 카테고리의 다른 글
[c++] 11866번 : 요세푸스 문제 0 (0) | 2022.05.12 |
---|---|
[c++] 11651번 : 좌표 정렬하기2 (0) | 2022.05.12 |
[c++] 11050번 : 이항 계수 1 (0) | 2022.05.10 |
[c++] 10989번 : 수 정렬하기3 (0) | 2022.05.10 |
[c++] 10866번 : 덱 (0) | 2022.05.10 |