-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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 | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
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++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 체크하면 되는군요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!!
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 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 그래도 변수명을 잘지으셔서 이해가 잘 됩니다!
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 | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
플로이드 워셜로 구할 수도 있군요,,,!
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 방향으로만 해도 되는군요,,,,,,
📌 from issue #214 📌
📋문제 목록📋