-
Notifications
You must be signed in to change notification settings - Fork 5
HONGJOO / 4월 4주차 /3개 #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HONGJOO / 4월 4주차 /3개 #203
Conversation
Mingguriguri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 문제 풀 때는 1시간 정해두고 못 풀면 풀이 보고 이해하고 정리하는 과정을 걸리더라구요.. 특히 DP는 시간 안에 아이디어 못 떠올릴 때가 많아서 진짜 경험 싸움인 것 같기도 합니다..ㅜㅜ
이번 주도 고생 많으셨습니다~ 다음 주도 화이팅!!
Hongjoo/백준/두용액.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 두 용액을 더한 값을 따로 변수로 두었는데 이렇게 하나의 리스트에 한 번에 관리해도 좋겠군요!
Hongjoo/백준/세용액.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
홍주님처럼 합이 0이면 바로 출력하고 종료하는 것도 효율적이겠네요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번 발제 문제와 과제 문제 모두 잘 풀어주신것 같습니다.
# x < y<z 일때 - X 는 fix , y,z는 투 포인터
위와 같이 주석에도 잘 작성해 주셨듯, 과제 문제는 N이 5000개까지이므로 O(N log N)의 시간복잡도를 사용할 수 있는 문제였습니다. 따라서 선형으로 O(N) 시간복잡도를 써서 세 용액중 하나를 고정시켜놓고, 발제문제에서 사용한 투 포인터 알고리즘으로 O(log N) 시간 복잡도를 써서 나머지 용액 중 절댓값이 0에 가장 가까운 두 용액을 찾으면 되는 문제였습니다.
한 주 수고하셨습니다!!!
🔥2025-04 챌린지 진행 상황👉 그래프
👉 DP
|
🌱WIL
🚀주간 목표 문제 수: 5개
백준 #2470. 두 용액: 투포인터/ 골드5
정리한 링크: (바로가기)
🚩플로우 (선택)
🚩제출한 코드
💡TIL
##백준 #28069. 김밥천국의 계단: DP/ 골드5
정리한 링크: (바로가기)
🚩플로우 (선택)
(1) nex_i = 계단 +1
(2) nex_i = i + i//2
🚩제출한 코드
백준 #2473. 세 용액: 투포인터/ 골드3
정리한 링크: (바로가기)
🚩플로우 (선택)
(1) x 는 고정 : for문으로 0~ N-2 반복
(2) y,z는 범위 x+1 ~ N 사이에서 탐색
(3) abs(x+y+z) 의 최소값 & 조합 업데이트
🚩제출한 코드