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

[소병희] 양, 별자리 만들기, 에너지 모으기, 안전 영역 #85

Merged
merged 6 commits into from
Jan 29, 2023

Conversation

bngsh
Copy link
Contributor

@bngsh bngsh commented Jan 29, 2023

📌 from issue #81 📌

📋문제 목록📋

양: ✅
별자리 만들기: ✅
에너지 모으기: ⛔
안전 영역: ✅

@bngsh bngsh added the 병희 label Jan 29, 2023
@bngsh bngsh self-assigned this Jan 29, 2023
stars = Array(n) { readLine().split(" ").map { it.toDouble() } }
parent = IntArray(n) { it }

val pq = PriorityQueue(Comparator<Edge> { a, b -> (a.d - b.d).toInt() })
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 Author

Choose a reason for hiding this comment

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

아닙니다 맨날 똑같은것만 써요,,,

Comment on lines +8 to +10
const val FENCE = '#'
const val SHEEP = 'o'
const val WOLF = 'v'
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 0 until R) {
readLine().forEachIndexed { j, v ->
backyard[i+1][j+1] = v
Copy link
Member

Choose a reason for hiding this comment

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

테두리 감싸는 테크닉 나중에 저도 써먹어볼게요!!

import java.util.PriorityQueue
import kotlin.math.max

data class Node(var v: Int, var pre: Node? = null, var nxt: Node? = null)
Copy link
Member

Choose a reason for hiding this comment

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

크... 2중 연결리스트 멋있습니다

Copy link
Member

Choose a reason for hiding this comment

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

인죵 멋져요 병희님 😎


fun solve(): Unit = with(BufferedReader(InputStreamReader(System.`in`))) {
val (R, C) = readLine().split(" ").map { it.toInt() }
backyard = Array(R + 2) { CharArray(C + 2) { '#' } }
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 14 to 15
val maxV = balls.maxOf { it.v }
val maxList = balls.filter { it.v == maxV }
Copy link
Member

Choose a reason for hiding this comment

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

가장 큰 값이 중복일 때를 먼저 생각하고 짜신 게 멋있네요! 또 풀이 방법도 신선했습니다!

import java.util.PriorityQueue
import kotlin.math.max

data class Node(var v: Int, var pre: Node? = null, var nxt: Node? = null)
Copy link
Member

Choose a reason for hiding this comment

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

인죵 멋져요 병희님 😎


fun solve(): Unit = with(BufferedReader(InputStreamReader(System.`in`))) {
val (R, C) = readLine().split(" ").map { it.toInt() }
backyard = Array(R + 2) { CharArray(C + 2) { '#' } }
Copy link
Member

Choose a reason for hiding this comment

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

저도 써먹겠습니다 병희님

WOLF -> localWolf++
}

backyard[r][c] = FENCE
Copy link
Member

Choose a reason for hiding this comment

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

visited를 안쓰신게 인상깊었습니다!

@bngsh bngsh changed the title [소병희] 양, 별자리 만들기 [소병희] 양, 별자리 만들기, 에너지 모으기, 안전 영역 Jan 29, 2023
@bngsh bngsh merged commit 3e3dbaa into main Jan 29, 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