-
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
[소병희] 백도어, 탑, 주차장 #192
[소병희] 백도어, 탑, 주차장 #192
Conversation
val fee = IntArray(n) | ||
val weight = IntArray(m + 1) | ||
val parked = IntArray(m + 1) { -1 } | ||
val spaceQ = PriorityQueue<Int>() |
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.
spaceQ가 있으면 비어있는 빠른 인덱스을 찾는 시간이 안걸리겠네요!!
spaceQ.add(space) | ||
ans += fee[space] * weight[car * -1] | ||
} | ||
else waitQ.add(car) |
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.
무조건 q에 넣는거 신박하네용 😮
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()= with(System.`in`.bufferedReader()) { | ||
val (n, m) = readLine().split(" ").map { it.toInt() } | ||
val hideable = readLine().split(" ").map { it == "0" }.toBooleanArray() |
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"과의 일치여부로 true, false 로 만들 생각을 하시다니 대단해요
while (st.isNotEmpty() && towers[reach] > towers[st.first()]) { | ||
answer[st.removeFirst()] = reach + 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.
요렇게 While문 하나로도 깔끔하게 처리할 수 있군요
repeat(2*m) { | ||
val car = readLine().toInt() | ||
|
||
if (car < 0) { |
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 #190 📌
📋문제 목록📋