Skip to content

[오늘의 알고리즘] 구명보트#63

Merged
ing-eoking merged 1 commit intoBugShelter:mainfrom
yongjun-0903:04-01
May 26, 2025
Merged

[오늘의 알고리즘] 구명보트#63
ing-eoking merged 1 commit intoBugShelter:mainfrom
yongjun-0903:04-01

Conversation

@yongjun-0903
Copy link
Collaborator

📌 관련 문제

📋 풀이 요약

  • 무게 순으로 정렬한 다음에 무게와 인원 수의 제한을 두면서 배에 하나씩 태우는 걸로 생각함

😞 실패한 테스트 케이스

  • 실패

@yongjun-0903 yongjun-0903 requested a review from ing-eoking April 1, 2025 01:01
@yongjun-0903 yongjun-0903 self-assigned this Apr 1, 2025
@yongjun-0903 yongjun-0903 added Algorithm 알고리즘 문제 풀이 🐜 Study 알고리즘 문제 공부 labels Apr 1, 2025
@ing-eoking ing-eoking linked an issue Apr 1, 2025 that may be closed by this pull request
Copy link
Collaborator

@ing-eoking ing-eoking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아이디어는 맞으나 좀 더 수학적으로 계산하면서 접근할 필요가 있음
그리디였던 걸로..

@ing-eoking ing-eoking requested review from Copilot and ing-eoking and removed request for ing-eoking April 9, 2025 01:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition 'len(boat) <= 2' could allow more than two persons per boat. If the boat's capacity is two, consider changing this to 'len(boat) < 2' to enforce the correct limit.

Suggested change
if sum(boat) + person <= limit and len(boat) <= 2:
if sum(boat) + person <= limit and len(boat) < 2:

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the else branch, the current person is skipped and not reprocessed, which may result in an undercount of boats. Consider re-adding the current person back to the queue or re-evaluating without discarding this person.

Suggested change
else:
else:
queue.appendleft(person)

Copilot uses AI. Check for mistakes.
@ing-eoking ing-eoking merged commit dddbd8d into BugShelter:main May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Algorithm 알고리즘 문제 풀이 🐜 Study 알고리즘 문제 공부

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[오늘의 알고리즘] 구명보트

3 participants