728x90
목록sort_stable (1)
컴공댕이 공부일지
[ C++/cpp ] 백준 (10814 나이순 정렬) ⭐sort_stable
백준 10814번 나이순 정렬 (실버 5) https://www.acmicpc.net/problem/10814 (정답 코드) #include #include #include using namespace std; typedef pair p; bool cmp(const p &a, const p &b) { // 나이순 정렬 if(a.first!=b.first) { return a.first < b.first; } // 나이가 같으면 변화없이 그대로 ! else { return false; // 원래 순서 유지 ! } } void sortUser(vector& user) { // 입력 순서를 보존하는 안정적인 정렬을 보장하는 sort_stable stable_sort(user.begin(), user.end()..
문제 풀이/코딩 문제 풀이 모음
2024. 3. 2. 01:16
728x90