Skip to content

1005 분할정복#12

Merged
IAGREEBUT merged 17 commits intomainfrom
1005_분할정복
Oct 29, 2021

Hidden character warning

The head ref may contain hidden characters: "1005_\ubd84\ud560\uc815\ubcf5"
Merged

1005 분할정복#12
IAGREEBUT merged 17 commits intomainfrom
1005_분할정복

Conversation

@IAGREEBUT
Copy link
Copy Markdown
Collaborator

21314번 반례 알 수 있을까요? 예제랑 표에 나온 것들은 다 되는데 틀렸다고 나오네요

분할 정복문제들 어떤느낌으로 분리해야할지는 알겠는데 코드로 짜는게 너무 안 익숙해서 오래걸리길래
일단 다른 문제들부터 시도했습니다 !
최대한 해서 제출하겠습니다
감사합니다

Copy link
Copy Markdown

@bsa0322 bsa0322 left a comment

Choose a reason for hiding this comment

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

p2. 리뷰가 너무 늦었네요! 죄송합니다 ㅜㅜ 21314관련 코멘트도 아래에 남겼어요!
마감이 지나긴 했지만, 내일까지 제출해주시면 인정해드리겠습니다!! 수정 후 저 다시 리뷰어로 호출해주세요!! 수고하셨습니다~!

Comment on lines 16 to 20
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p2. i의 시작과 증가하는 값을 잘 설정하면 a의 배수에 바로 접근할 수 있어요!

Comment on lines 39 to 86
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

순열로 풀어주셨군요! 좋아요~!! 백트래킹 풀이법도 있으니, 올라온 샘플코드 확인해보셔도 좋을 것 같아요!

Comment on lines 45 to 52
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p2. 한 칸씩 미뤄서 n번 반복하는 것보다 1중 for문으로 더 간단하게 구현할 수 있어요! 지금 미루는 수가 n과 같네요! 어떻게 고칠 수 있을까요? 인덱스를 n을 활용해서 나타내면 돼요!

Comment on lines 108 to 131
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p2. deque를 사용해도 좋지만, 기존의 check배열을 계속 활용해봐도 좋을 것 같아요! 아니면 새로운 벡터를 만들어서 사용해도 좋아요
사실 deque는 앞과 뒤의 삽입과 삭제가 자유로울 때 더 효율이 나타나는 컨테이너인데, 지금은 크기가 항상 9로 정해져 있죠! 따라서 vector를 활용하는 것이 더 좋아보여요!
선수의 로테이션 구현은 삭제와 삽입 없이, 인덱스만으로도 충분히 할 수 있어요!

Comment on lines 37 to 40
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p3. 원소가 4개밖에 없어서 이렇게 써주시는 것도 좋지만, 반복문을 사용해봐도 좋을 것 같아요~!

Comment on lines 60 to 67
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

주석에 대한 사소한 코멘트입니다!
개념을 나눈다면, 두 번째로 큰 수를 구하는 부분이 combine입니다! 현재 마지막 함수 호출인 size == 2일 경우가 굳이 따지자면 conquer에 더 가까워요 !

Comment on lines 52 to 57
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

반례 말씀드릴께요!
민겸수의 최댓값을 구하는 과정에서 반례가 있어요.
만약 MKMMM 이라는 수의 최댓값은 현재대로면 50100을 출력하죠! 그런데 50100이 최댓값이 맞을까요? 더 이상 끝나는 수가 K가 아니니, 마지막 M은 굳이 한 번에 변환하지 않아도 괜찮겠네요!

@IAGREEBUT
Copy link
Copy Markdown
Collaborator Author

일단 먼저, 오답이었던 21314번 + 17829번 일단 정답으로 수정 마쳤습니다!
피드백 반영도 해서 수정하겠습니다
감사합니다!

@IAGREEBUT IAGREEBUT requested a review from bsa0322 October 27, 2021 16:42
Copy link
Copy Markdown

@bsa0322 bsa0322 left a comment

Choose a reason for hiding this comment

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

코멘트 참고하여 수정해주신 부분 확인했어요! 다 너무 좋아요! 넘 수고하셨습니다!! 👍👍
조금 늦었지만 21314도 간단한 코멘트 남겨봤어욥 ! 수정해보셔도 좋고, 샘플코드를 참고해보셔도 좋아요
해당 pr은 머지하셔도 괜찮아요!!! 수고하셨습니다 😊

Comment on lines 47 to 52
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

좋아요~! 👍

Comment on lines 24 to 26
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p2. 불필요한 컨테이너 사용은 줄이는 게 좋아요! 현재 큐 컨테이너에 삽입 삭제가 계속 이루어지는 것이 아니라 해당 인덱스의 값을 꺼내오는 경우로만 사용되고 있네요! 이건 배열의 인덱스에 바로 접근 후, 인덱스를 증가시켜주는 연산과 정확히 동일하겠죠!
즉, 처음 받은 string을 바로 사용하는 게 좋아요~!

Comment on lines 36 to 46
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

p2. K를 찾고, 반복문을 통해 수를 만들어주는 것도 좋지만, 그 전부터 미리 max_str을 만들어 오면 O(n)으로 해당 문제를 풀이할 수 있어요! 지금은 O(n^2)의 시간복잡도를 가지네요.

@IAGREEBUT IAGREEBUT merged commit a3ead76 into main Oct 29, 2021
@IAGREEBUT IAGREEBUT deleted the 1005_분할정복 branch October 29, 2021 04:09
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.

2 participants