-
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
[장희직] - 항체 인식, 토마토, 우체국, 문자열 게임 2 #223
Conversation
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.
고생하셨어요!!
@@ -0,0 +1,43 @@ | |||
package heejik.`54week` | |||
|
|||
import kotlin.coroutines.suspendCoroutine |
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.
????
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.
ㅋㅋㅋㅋ 따로 테스트할 코드를 짜다가,, 들어갔네요😅
|
||
answers.forEach { | ||
println( | ||
if (it.first == Int.MAX_VALUE) -1 |
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.
어차피 한번에 둘 다 갱신이 되니까 한 번만 확인해보면 되는군요,,,
answer3 = min(answer3, it[i + k - 1] - it[i] + 1) | ||
answer4 = max(answer4, it[i + k - 1] - it[i] + 1) |
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.
아주 직관적이고 이해가 쉽네요
package heejik.`54week` | ||
|
||
|
||
// https://velog.io/@yunlee/BOJ-2141%EB%B2%88-%EC%9A%B0%EC%B2%B4%EA%B5%AD-Java |
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.
설명 감사합니다... 그나마 이해가 조금되었어요.
while (deque.isNotEmpty()) { | ||
repeat(tmpRipeCount) { | ||
val (x, y) = deque.removeFirst() | ||
for (i in 0..3) { | ||
val nx = x + dx[i] | ||
val ny = y + dy[i] | ||
if (nx in 0 until m && ny in 0 until n && board[nx][ny] == 0) { | ||
nextDeque.add(Pos(nx, ny)) | ||
board[nx][ny] = 1 | ||
ripeCount++ | ||
nextRipeCount++ | ||
isRipen = true | ||
} | ||
} | ||
} | ||
tmpRipeCount = nextRipeCount | ||
nextRipeCount = 0 | ||
deque.addAll(nextDeque) | ||
nextDeque.clear() | ||
if (isRipen) day++ | ||
isRipen = false | ||
} |
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.
30분컷 리스펙
var isRipen = false | ||
|
||
while (deque.isNotEmpty()) { | ||
repeat(tmpRipeCount) { |
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.
방법이 독특해서 좋았습니다!
package heejik.`54week` | ||
|
||
|
||
// https://velog.io/@yunlee/BOJ-2141%EB%B2%88-%EC%9A%B0%EC%B2%B4%EA%B5%AD-Java |
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.
설명 덕분에 이해가 잘 갔습니다!
@@ -0,0 +1,43 @@ | |||
package heejik.`54week` | |||
|
|||
import kotlin.coroutines.suspendCoroutine |
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.
????
allSum += a | ||
} | ||
|
||
populations.sortedBy { it.first }.forEach { |
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.
맨날 정렬은 무지성 우선순위큐 써서 고차함수를 잊고 살았네요...깔끔쓰
while (deque.isNotEmpty()) { | ||
repeat(tmpRipeCount) { | ||
val (x, y) = deque.removeFirst() | ||
for (i in 0..3) { | ||
val nx = x + dx[i] | ||
val ny = y + dy[i] | ||
if (nx in 0 until m && ny in 0 until n && board[nx][ny] == 0) { | ||
nextDeque.add(Pos(nx, ny)) | ||
board[nx][ny] = 1 | ||
ripeCount++ | ||
nextRipeCount++ | ||
isRipen = true | ||
} | ||
} | ||
} | ||
tmpRipeCount = nextRipeCount | ||
nextRipeCount = 0 | ||
deque.addAll(nextDeque) | ||
nextDeque.clear() | ||
if (isRipen) day++ | ||
isRipen = false | ||
} |
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.
30분컷 리스펙
📌 from issue #220 📌
📋문제 목록📋
📍추가로 해결한 문제📍