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

[장희직] - 케빈 베이컨의 6단계 법칙, 전구와 스위치, CCW, 함께 블록 쌓기 #172

Merged
merged 4 commits into from
Sep 11, 2023

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Sep 11, 2023

📌 from issue #170 📌

📋문제 목록📋

케빈 베이컨의 6단계 법칙: ✅
전구와 스위치: ✅
CCW: ⛔️
함께 블록 쌓기: ✅
 

📝메모

CCW?

@jhg3410 jhg3410 added the 희직 label Sep 11, 2023
@jhg3410 jhg3410 self-assigned this Sep 11, 2023
Comment on lines +20 to +21
val vectorP1P2 = Vector(p2X - p1X, p2Y - p1Y)
val vectorP1P3 = Vector(p3X - p1X, p3Y - p1Y)
Copy link
Member

Choose a reason for hiding this comment

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

너무 자연스러워서 진짜 있는 클래스인 줄 알았네요

Comment on lines +42 to +53
val queue = ArrayDeque<Pair<Int, Int>>()
queue.add(Pair(standard, 0))

while (queue.isNotEmpty()) {
val (man, count) = queue.removeFirst()
if (findRelations.add(man)) {
totalCount += count
relations[man].forEach {
if (it !in findRelations) queue.add(Pair(it, count + 1))
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

아 저처럼 초기 친구들 안 구하고 이렇게 해도 되겠군요...ㅋㅋㅋㅋㅋㅋㅋㅋ

Comment on lines +7 to +8
val dp = MutableList(size = h + 1) { 0 }
val tmpStored = MutableList(size = h + 1) { 0 }
Copy link
Member

Choose a reason for hiding this comment

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

1차원 dp 테이블 + 중복을 방지하기 위한 tmp저장소까지.. 다음에 비슷한 방식으로 시도해보겠습니다!

Comment on lines +23 to +27
(vectorP1P2.x * vectorP1P3.y - vectorP1P3.x * vectorP1P2.y).run {
if (this < 0) print(-1)
if (this == 0) print(0)
if (this > 0) print(1)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 아주 좋다고 생각했슴당

answers[man] = bfs(man)
}
val minCount = answers.min()
println(answers)
Copy link
Contributor

Choose a reason for hiding this comment

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

ㅇ ㅔ ? 디버깅용이었나유?

Copy link
Member Author

Choose a reason for hiding this comment

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

어 이게 왜 같이 올라갔지....?

}
val minCount = answers.min()
println(answers)
println(answers.indexOfFirst { it == minCount })
Copy link
Contributor

Choose a reason for hiding this comment

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

오 indexOfFirst 좋네요

Copy link
Member

Choose a reason for hiding this comment

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

요거 참 좋네요

dp[index] += i
dp[index] %= 10007
}
tmpStored.fill(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

헉...fill을 완전 잊고 있었네요 담엔 배열 초기화에 참고하겠습니다!

}
val minCount = answers.min()
println(answers)
println(answers.indexOfFirst { it == minCount })
Copy link
Member

Choose a reason for hiding this comment

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

요거 참 좋네요

Comment on lines +9 to +10
state[0] = (state[0] + 1) % 2
state[1] = (state[1] + 1) % 2
Copy link
Member

Choose a reason for hiding this comment

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

요 칭구도 좋네요!

dp[0] = 1

repeat(n) {
val heights = readln().split(' ').map { it.toInt() }
Copy link
Member

Choose a reason for hiding this comment

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

입력받자마자 처리하는게 멋있네요 😎

@jhg3410 jhg3410 merged commit a60ece9 into main Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants