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

[전현수] - 백도어, 주차장, 순위, 탑 #191

Merged
merged 4 commits into from
Oct 15, 2023
Merged

Conversation

soopeach
Copy link
Member

📌 from issue #190 📌

📋문제 목록📋

백도어: ✅
주차장: ✅
순위: ⛔️
탑: ✅

📍추가로 해결한 문제📍

추천: 👍  
비추천: 👎  
문제에 대한 간단한 코멘트를 남겨주셔도 좋을 것 같아요!

📝메모

공유하고 싶은 정보, 새롭게 알게된 것, 문제를 풀면서 발생한 에로사항 등...자유롭게!


Comment on lines +47 to +50
pq.add(Bundle(0, 0))
costTable[0] = 0

while (pq.isNotEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

현수님 코드보고 어디 틀렸는지 찾았습니다...
오늘의 교훈: 첫 노드를 따로 빼지 말고 (0, 0)으로 큐에 넣자...

Comment on lines +80 to +83
parkingLot.forEachIndexed { index, carNum ->
if (index == 0 || carNum == 0) return@forEachIndexed
totalFee += priceInfo[index] * weightInfo[carNum]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

저는 이경우를 아예 생각을 못해서 처리를 못해줬는데
문제에 모든 차가 1번 들어오고 한번 나간다, 입력이 2m개다라는 조건이 있어서 입력이 끝나면 항상 주차장도 대기큐도 텅텅스인가봐요

}

println(
if (laserPosList.drop(1).all { it == 0 }) 0
Copy link
Contributor

Choose a reason for hiding this comment

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

헉 이거 0 0 0 0 0 이렇게 출력하라는 게 아니라 0만 출력하라는 뜻이었나요?!

Copy link
Member Author

Choose a reason for hiding this comment

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

@bngsh 마자요..!!

Comment on lines +25 to +28
val parkingLot = IntArray(10001)

val priceInfo = IntArray(10001)
val weightInfo = IntArray(10001)
Copy link
Member

Choose a reason for hiding this comment

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

변수명 고민했었는데 너무 맘에 드네요!!


val (startIndex, curCost) = pq.poll()

if (costTable[startIndex] < curCost) continue
Copy link
Member

Choose a reason for hiding this comment

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

설명 감사합니다!!🙂


var totalFee = 0

val queue: Queue<Int> = LinkedList()
Copy link
Member

Choose a reason for hiding this comment

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

deque보다 linkedlist가 더 좋나요?? 👀

Copy link
Member Author

Choose a reason for hiding this comment

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

@jeeminimini 성능은 더 구린 걸로 알고있어요!! ㅋㅋㅋㅋㅋ그냥 저거에 익숙해서 저것만 쓰고있긴합니다,,,


val (startIndex, curCost) = pq.poll()

if (costTable[startIndex] < curCost) continue
Copy link
Member

Choose a reason for hiding this comment

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

오 이걸로 visited 처리를 해줄 수 있군요....!

for (k in 1 .. n) {
for (i in 1 .. n) {
for (j in 1 .. n) {
if (resultTable[i][k] == WIN && resultTable[k][j] == WIN) {
Copy link
Member

Choose a reason for hiding this comment

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

이걸 WIN만 봐도 되는군요??

@soopeach soopeach merged commit c5ee54c into main Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants