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
- bfs
- c++
- 컴공과
- 문제풀이
- 브루트포스
- 컴공
- OS
- Stack
- vector
- 오퍼레이팅시스템
- Operating System
- DP
- 오에스
- Computer science
- 너비우선탐색
- 스택
- 정석학술정보관
- 자료구조
- 북리뷰
- 백준
- 컴퓨터공학과
- 정석
- 구현
- coding
- 알고리즘
- 그래프
- 개발
- 코딩
- 코테
- cs
Archives
- Today
- Total
Little Jay
[C++] 백준 11650번 좌표 정렬하기 본문
시간복잡도는 O(n)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int testcase, x, y;
vector<pair<int, int>> vec;
cin >> testcase;
for (int i = 0; i < testcase; i++) {
cin >> x >> y;
vec.push_back(make_pair(x, y));
}
sort(vec.begin(), vec.end());
for (int i = 0; i < testcase; i++) {
cout << vec[i].first << " " << vec[i].second << "\n";
}
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 2775번 부녀회장이 될테야 (0) | 2021.03.26 |
---|---|
[C++] 백준 4153번 직각삼각형 (0) | 2021.03.26 |
[C++] 백준 11170번 0의 개수 (0) | 2021.03.25 |
[C++] 백준 14912번 숫자 빈도수 (0) | 2021.03.25 |
[C++] 백준 1531번 투명 (0) | 2021.03.23 |
Comments