Skip to content
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

[동적계획법] 4월 2일 #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Jiwoon-Yoon
Copy link
Collaborator

@Jiwoon-Yoon Jiwoon-Yoon commented Apr 2, 2024

인적사항

학번: 2276209
이름: 윤지운

과제제출

기존 제출: 2579, 11053
추가 제출: 20923

Copy link

@chaeri93 chaeri93 left a comment

Choose a reason for hiding this comment

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

[동적계획법 구현 코드리뷰 완료]
20923(P3)
지운님 안녕하세요! 추가제출 확인 완료되었습니다👍 수고하셨습니다!

Copy link

@aeyongdodam aeyongdodam left a comment

Choose a reason for hiding this comment

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

11053(P3), 2579(P3)
안녕하세요 정아님! 코드 리뷰 완료되었습니다👍
함수 분리, 명확한 네이밍 너무 좋았습니다!
문제 해결에 필요한 dp 점화식도 너무 잘 찾아주셨습니다!!
몇 가지 사소한 코멘트 남겼습니다.
궁금하신 점이 있다면 리뷰어를 호출해주세요!

Choose a reason for hiding this comment

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

P3: 라이브 코딩 파일까지 올려주시다니 너무 대단하십니다!! 최고~!


vector<int>arr;

int lis(int n) {

Choose a reason for hiding this comment

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

P3: 함수 분리, 명확한 함수 네이밍 너무 좋네요!

Comment on lines +12 to +18
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[j] < arr[i]) {
dp[i] = max(dp[j] + 1, dp[i]);
}
}
}

Choose a reason for hiding this comment

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

P3: 증가하는 부분 수열 조건을 잘 찾아주셨네요!!

Comment on lines +20 to +24
for (int i = 0; i < n; i++) {
if (len < dp[i]) {
len = dp[i];
}
}

Choose a reason for hiding this comment

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

P3: max_element를 이용하여 함수 길이를 줄이는 방법도 추천드립니다!


vector<int>score;

int findMax(int n) {

Choose a reason for hiding this comment

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

P3: 함수 분리, 명확한 함수 네이밍 너무 좋습니다~~

Comment on lines +11 to +17
dp[0] = score[0];
dp[1] = score[0] + score[1];
dp[2] = max(score[0] + score[2], score[1] + score[2]); //1+3, 2+3 되는데 2+3 처음에 생각 못함!

for (int i = 3; i < n; i++) {
dp[i] = max(dp[i - 2] + score[i], dp[i - 3] + score[i - 1] + score[i]);
}

Choose a reason for hiding this comment

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

P3: 계단오르기 점화식 조건을 잘 찾아주셨네요!! dp는 점화식을 세우면 반은 끝나는 것 같습니다ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants