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

[장희직] - 항체 인식, 토마토, 우체국, 문자열 게임 2 #223

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Mar 16, 2024

📌 from issue #220 📌

📋문제 목록📋

항체 인식: ✅
토마토: ✅
우체국: ⛔️
문자열 게임 2: ✅

📍추가로 해결한 문제📍

@jhg3410 jhg3410 added the 희직 label Mar 16, 2024
@jhg3410 jhg3410 self-assigned this Mar 16, 2024
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.

고생하셨어요!!

@@ -0,0 +1,43 @@
package heejik.`54week`

import kotlin.coroutines.suspendCoroutine
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

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.

ㅋㅋㅋㅋ 따로 테스트할 코드를 짜다가,, 들어갔네요😅


answers.forEach {
println(
if (it.first == Int.MAX_VALUE) -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 +38 to +39
answer3 = min(answer3, it[i + k - 1] - it[i] + 1)
answer4 = max(answer4, it[i + k - 1] - it[i] + 1)
Copy link
Member

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
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 +37 to +58
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
}
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

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) {
Copy link
Member

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
Copy link
Member

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
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

맨날 정렬은 무지성 우선순위큐 써서 고차함수를 잊고 살았네요...깔끔쓰

Comment on lines +37 to +58
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
}
Copy link
Contributor

Choose a reason for hiding this comment

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

30분컷 리스펙

@jhg3410 jhg3410 merged commit 7098019 into main Mar 16, 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