Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
유형: dfs, dp
등급: 골드
url: https://www.acmicpc.net/problem/17130
오늘 부터 AI 리뷰를 올려 놓도록 하겠습니다.~~~
문제 분석
j+1)로만 이동 가능 (DAG 구조).-1, 0, +1변화 가능.-1반환.구현 전략
memo[n][m]배열을-1로 초기화하여 중복 계산 방지.dfs(x, y)함수는(x, y)위치에서 도달 가능한 탈출구까지의 최대 당근 개수를 반환.res = -2를 도달 불가능 상태로 정의하고, 구멍('O')을 발견하면res = 0으로 탐색 시작.-2가 아닌 경우에만 현재 위치의 당근 개수를 더해 최댓값(Math.max) 갱신.트러블슈팅
int[]로 오판함.char[][]로 변경하여 해결.-1과-2등으로 구분하지 않아 샘플 2번에서 오답 발생. 초기값을-2로 설정하고 전파하여 성공한 경로만 추적하도록 수정.res=0으로 세팅 후 다음 칸 탐색을 계속하도록 로직 보강.res를 클래스 멤버 변수로 써서 재귀 호출 간 값이 덮어씌워지는 문제 발생. 지역 변수로 변경하여 독립성 확보.강점 및 약점
-2) 간의 관계를 정리하는 데 시간이 다소 소요됨.AI 도움 임계점
-2또는-987654321)로 리턴하여Math.max비교에서 제외하도록 하는 힌트가 결정적이었음.추천 문제 (학습 흐름 연계)