-
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
[소병희] 양, 별자리 만들기, 에너지 모으기, 안전 영역 #85
Conversation
stars = Array(n) { readLine().split(" ").map { it.toDouble() } } | ||
parent = IntArray(n) { it } | ||
|
||
val pq = PriorityQueue(Comparator<Edge> { a, b -> (a.d - b.d).toInt() }) |
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.
아닙니다 맨날 똑같은것만 써요,,,
const val FENCE = '#' | ||
const val SHEEP = 'o' | ||
const val WOLF = 'v' |
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 0 until R) { | ||
readLine().forEachIndexed { j, v -> | ||
backyard[i+1][j+1] = v |
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.
테두리 감싸는 테크닉 나중에 저도 써먹어볼게요!!
import java.util.PriorityQueue | ||
import kotlin.math.max | ||
|
||
data class Node(var v: Int, var pre: Node? = null, var nxt: Node? = null) |
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.
크... 2중 연결리스트 멋있습니다
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.
인죵 멋져요 병희님 😎
|
||
fun solve(): Unit = with(BufferedReader(InputStreamReader(System.`in`))) { | ||
val (R, C) = readLine().split(" ").map { it.toInt() } | ||
backyard = Array(R + 2) { CharArray(C + 2) { '#' } } |
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.
다음엔 이렇게 풀어봐야겠습니다!! 👍
val maxV = balls.maxOf { it.v } | ||
val maxList = balls.filter { it.v == maxV } |
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.
가장 큰 값이 중복일 때를 먼저 생각하고 짜신 게 멋있네요! 또 풀이 방법도 신선했습니다!
import java.util.PriorityQueue | ||
import kotlin.math.max | ||
|
||
data class Node(var v: Int, var pre: Node? = null, var nxt: Node? = null) |
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.
인죵 멋져요 병희님 😎
|
||
fun solve(): Unit = with(BufferedReader(InputStreamReader(System.`in`))) { | ||
val (R, C) = readLine().split(" ").map { it.toInt() } | ||
backyard = Array(R + 2) { CharArray(C + 2) { '#' } } |
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.
저도 써먹겠습니다 병희님
WOLF -> localWolf++ | ||
} | ||
|
||
backyard[r][c] = FENCE |
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.
visited를 안쓰신게 인상깊었습니다!
📌 from issue #81 📌
📋문제 목록📋