Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[25주차] 이지영 #339

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

Merged
KodaHye merged 7 commits into GreatAlgorithm-Study:main from yeongleej:main
Mar 8, 2025
Merged

[25주차] 이지영 #339

KodaHye merged 7 commits into GreatAlgorithm-Study:main from yeongleej:main
Mar 8, 2025

Conversation

Copy link
Contributor

@yeongleej yeongleej commented Mar 4, 2025

No description provided.

visited[now] = true;

// 리프노드라면 자신의 비용 반환
if(now !=1 && g[now].size() == 1) return g[now].get(0).cost;
Copy link
Contributor

@jewan100 jewan100 Mar 6, 2025

Choose a reason for hiding this comment

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

섬이 1밖에 없을 때랑 리프노드 판단하는거 이렇게 하면 되는거였군요...
저는 if문 떡칠해버렸는데 배워갑니돠

jmxx219 reacted with thumbs up emoji yeongleej reacted with laugh emoji
Comment on lines +52 to +54
else {
dfs(i, j, d, 1, 0);
}
Copy link
Contributor

@KodaHye KodaHye Mar 6, 2025

Choose a reason for hiding this comment

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

d 방향으로 이동이 불가능하면 이 과정이 없어도 될 것 같다고 생각하는데, 왜 있는지 궁금합니다!

Copy link
Contributor Author

@yeongleej yeongleej Mar 6, 2025
edited
Loading

Choose a reason for hiding this comment

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

7 7
*******
*******
*******
***.***
*******
*******
*******

d방향으로 움직일 수 없는 경우 0으로 시작하면 이후 탐색에서 움직을 수 있는 방향을 찾아 단계1로 시작되도록 했습니다. 이는 위 테스트케이스 처럼 움직일 수 있는 곳이 딱 1칸일 경우는 시작하자마자 종료되기 때문에 최소 이동횟수가 0이되야하는데 아예 탐색을 안하면 -1이되기 때문에 탐색을 진행해서 최소 움직임 횟수를 0으로 출력하도록 하기 위해 작성했습니다.

아 그리고 주석에 단계2부터 시작은 오타입니다,,, ᄒᄒᄒ 단계 0부터 시작입니다!

KodaHye reacted with thumbs up emoji
M = m;

dp = new int[SIZE][M];
// dp[i][j] : i번째 물건까지 탐색했고 B의 흔적이 j일때, A의 최소 흔적
Copy link
Contributor

@jmxx219 jmxx219 Mar 6, 2025

Choose a reason for hiding this comment

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

저는 무조건 3차원 배열로 풀어야 된다고 생각했는데,, 이 아이디어를 생각하는게 너무 어려운 것 같습니다..

@KodaHye KodaHye merged commit 27d707e into GreatAlgorithm-Study:main Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@jmxx219 jmxx219 jmxx219 approved these changes

@KodaHye KodaHye KodaHye approved these changes

+1 more reviewer

@jewan100 jewan100 jewan100 approved these changes

Reviewers whose approvals may not affect merge requirements
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /