반응형 [PCCP] Lv2: 구명보트(42885) 해설 문제- 문제 링크: 구명보트 해설- 자료구조: - 시간복잡도: (풀이과정)1) 2) 3) 4) 코드(C언어)solution 1)더보기solution 1#includesolution 2)더보기#includesolution 3)더보기#include (C++)solution 1)- N: people의 길이- sort(): O(NlogN)- 반복문은 최악의 경우 people 배열 끝까지 반복하므로 최종 시간 복잡도: O(NlogN)더보기#include #include using namespace std;int solution(vector people, int limit) { sort(people.begin(), people.end()); // 몸무게를 오름차순으로 정렬 int count = 0; .. 2024. 12. 25. 이전 1 다음 반응형