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

[장희직] - 작업, 키 순서, 구간 합 구하기 5, 도넛과 막대 그래프 #219

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Mar 10, 2024

📌 from issue #214 📌

📋문제 목록📋

작업: ✅
키 순서: ⛔️
구간 합 구하기 5: ✅
도넛과 막대 그래프: ✅

@jhg3410 jhg3410 self-assigned this Mar 10, 2024
@jhg3410 jhg3410 added the 희직 label Mar 10, 2024
Comment on lines +35 to +44
private fun createRelation() {
for (k in 1..n) {
for (i in 1..n) {
for (j in 1..n) {
if (relation[i][k] && relation[k][j])
relation[i][j] = true
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

플루이드 워셜 엄청난 친구네요

for (i in 1..n) {
var count = 0
for (j in 1..n) {
if (relation[i][j] || relation[j][i]) count++
Copy link
Member

Choose a reason for hiding this comment

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

이렇게 체크하면 되는군요 👍

Copy link
Member

@soopeach soopeach left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!!

Comment on lines +44 to +49
private fun getPrefixSum(x1: Int, y1: Int, x2: Int, y2: Int): Int {
val leftSum = if (y1 == 0) 0 else board[x2][y1 - 1]
val upSum = if (x1 == 0) 0 else board[x1 - 1][y2]
val diagonalSum = if (x1 == 0 || y1 == 0) 0 else board[x1 - 1][y1 - 1]
return board[x2][y2] - leftSum - upSum + diagonalSum
}
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 +35 to +44
private fun createRelation() {
for (k in 1..n) {
for (i in 1..n) {
for (j in 1..n) {
if (relation[i][k] && relation[k][j])
relation[i][j] = true
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

플로이드 워셜로 구할 수도 있군요,,,!

Copy link
Contributor

@bngsh bngsh left a comment

Choose a reason for hiding this comment

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

도넛과 막대그래프 인아웃 개수만 세는 풀이법 설명해주신 게 진짜 충격이었습니다,,, 정보공유 감사합니다~~


repeat(m) {
val (small, large) = br.readLine().split(' ').map { it.toInt() }
relation[small][large] = true
Copy link
Contributor

Choose a reason for hiding this comment

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

한 방향으로만 해도 되는군요,,,,,,

@jhg3410 jhg3410 merged commit ec7e1cf into main Mar 10, 2024
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