-
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
[전현수] - 백도어, 주차장, 순위, 탑 #191
Conversation
pq.add(Bundle(0, 0)) | ||
costTable[0] = 0 | ||
|
||
while (pq.isNotEmpty()) { |
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, 0)으로 큐에 넣자...
parkingLot.forEachIndexed { index, carNum -> | ||
if (index == 0 || carNum == 0) return@forEachIndexed | ||
totalFee += priceInfo[index] * weightInfo[carNum] | ||
} |
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.
저는 이경우를 아예 생각을 못해서 처리를 못해줬는데
문제에 모든 차가 1번 들어오고 한번 나간다, 입력이 2m개다라는 조건이 있어서 입력이 끝나면 항상 주차장도 대기큐도 텅텅스인가봐요
} | ||
|
||
println( | ||
if (laserPosList.drop(1).all { it == 0 }) 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.
헉 이거 0 0 0 0 0 이렇게 출력하라는 게 아니라 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.
@bngsh 마자요..!!
val parkingLot = IntArray(10001) | ||
|
||
val priceInfo = IntArray(10001) | ||
val weightInfo = IntArray(10001) |
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 (startIndex, curCost) = pq.poll() | ||
|
||
if (costTable[startIndex] < curCost) continue |
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.
설명 감사합니다!!🙂
|
||
var totalFee = 0 | ||
|
||
val queue: Queue<Int> = LinkedList() |
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.
deque보다 linkedlist가 더 좋나요?? 👀
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.
@jeeminimini 성능은 더 구린 걸로 알고있어요!! ㅋㅋㅋㅋㅋ그냥 저거에 익숙해서 저것만 쓰고있긴합니다,,,
|
||
val (startIndex, curCost) = pq.poll() | ||
|
||
if (costTable[startIndex] < curCost) continue |
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 처리를 해줄 수 있군요....!
for (k in 1 .. n) { | ||
for (i in 1 .. n) { | ||
for (j in 1 .. n) { | ||
if (resultTable[i][k] == WIN && resultTable[k][j] == WIN) { |
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.
이걸 WIN만 봐도 되는군요??
📌 from issue #190 📌
📋문제 목록📋
📍추가로 해결한 문제📍
📝메모
공유하고 싶은 정보, 새롭게 알게된 것, 문제를 풀면서 발생한 에로사항 등...자유롭게!