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 | 31 |
Tags
- 코딩
- 자료구조
- cs
- coding
- 스택
- vector
- 문제풀이
- 오에스
- c++
- 오퍼레이팅시스템
- 컴공과
- bfs
- 개발
- Operating System
- 컴공
- DP
- Computer science
- 그래프
- OS
- Stack
- 정석학술정보관
- 백준
- 정석
- 코테
- 구현
- 브루트포스
- 북리뷰
- 너비우선탐색
- 컴퓨터공학과
- 알고리즘
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