Week7 강혜성1103 게임 풀이#133
Open
Fortuna3Co wants to merge 8 commits intoManduTheCat:mainfrom
Open
Conversation
…_algorithm_study into khs-BJ_game1103
…_algorithm_study into khs-BJ_game1103
Collaborator
|
설명을 쉽게 잘 적어주셔서 왜 bfs로도 풀리는지 이해가 쉽게 되었습니다 |
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.
game1103 KHS 클릭하시면 코드 볼 수 있습니다.
풀이
(한번 방문한 경우 다지 재 방문하지 않기 때문에)
ex) queue 사용
0 1 1
0 1 1
1 1 1
위와 같은 형태가 주어졌을 때, 첫 번째 방문에서는 오른쪽과 아래쪽을 탐색하게 됩니다.
이 때 잃는 생명력은 오른쪽일 경우 1(1, 0), 아래쪽일 경우 0(0, 1) 입니다. (x, y)
두 번째 방문을 처리하는 경우에 오른쪽부터 처리하게 될 경우 사방인 오른쪽(2, 0), 아래쪽(1, 1)을 탐색하게 되고
각 각에서 잃는 생명력은 2가 됩니다.
하지만 아래쪽 부터 처리하게 될 경우에는 오른쪽 (1, 1), 아래쪽 (0, 2)를 탐색하게 되고
각 각에서 잃는 생명력은 1이 됩니다.
이와 같은 경우를 방지하기 위해서 잃은 생명력이 최소인 지점에서부터 탐색을 합니다. -> priority queue 사용
리뷰 요청 사항
느낀점