사생활 보호 설정
https://gamjia.tistory.com
Updated News
Mini Rooms
답글수 [0]
What Friends Say
한마디로 표현해봐~
1촌평 관리
11650번 좌표 정렬하기
GamJia 2023. 4. 3. 09:09
단계별로 풀어보기 - 정렬 - 6단계
https://www.acmicpc.net/problem/11650
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { vector<pair<int,int>>v; int N,x,y; cin>>N; for(int i=0;i<N;i++) { cin>>x>>y; v.push_back({x,y}); } sort(v.begin(),v.end()); for(int i=0;i<N;i++) { cout<<v[i].first<<" "<<v[i].second<<"\n"; } return 0; }
🔊 pair<type,type>은
지정한 타입을 저장하고
.first/.second로 접근 가능하다