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

[소병희] 백도어, 탑, 주차장 #192

Merged
merged 4 commits into from
Oct 15, 2023
Merged

[소병희] 백도어, 탑, 주차장 #192

merged 4 commits into from
Oct 15, 2023

Conversation

bngsh
Copy link
Contributor

@bngsh bngsh commented Oct 15, 2023

📌 from issue #190 📌

📋문제 목록📋

탑: ✅
주차장: ✅
백도어: ✅
순위: ❎

@bngsh bngsh added the 병희 label Oct 15, 2023
@bngsh bngsh self-assigned this Oct 15, 2023
val fee = IntArray(n)
val weight = IntArray(m + 1)
val parked = IntArray(m + 1) { -1 }
val spaceQ = PriorityQueue<Int>()
Copy link
Member

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

Choose a reason for hiding this comment

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

무조건 q에 넣는거 신박하네용 😮

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.

고생하셨습니다!!


fun solve()= with(System.`in`.bufferedReader()) {
val (n, m) = readLine().split(" ").map { it.toInt() }
val hideable = readLine().split(" ").map { it == "0" }.toBooleanArray()
Copy link
Member

Choose a reason for hiding this comment

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

"0"과의 일치여부로 true, false 로 만들 생각을 하시다니 대단해요

Comment on lines +18 to +20
while (st.isNotEmpty() && towers[reach] > towers[st.first()]) {
answer[st.removeFirst()] = reach + 1
}
Copy link
Member

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

Choose a reason for hiding this comment

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

빼내는 처리 먼저 하니 코드가 간결해지네요!😲

@bngsh bngsh merged commit 3b70416 into main Oct 15, 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