Written by JS970
on
on
11651 - 좌표 정렬하기 2
- 난이도: 실버 5
- 날짜: 2023년 2월 10일
- 상태: Correct
- 추가 검토 여부: No
solution
- pair를 사용해서 문제 조건에 맞게 정렬되어 출력되도록 한다.
code
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
pair<int, int> * arr = new pair<int, int>[N];
for(int i = 0; i < N; i++)
cin >> arr[i].second >> arr[i].first;
sort(arr, arr+N);
for(int i = 0; i < N; i++)
cout << arr[i].second << " " << arr[i].first << '\n';
return 0;
}