-
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
[장희직] - 주차장, 순위, 탑 #194
[장희직] - 주차장, 순위, 탑 #194
Conversation
results.map { it.toResult() }.forEach { result -> | ||
wins[result.winner].add(result.loser) | ||
wins[result.winner].addAll(wins[result.loser]) | ||
|
||
wins.filter { result.winner in it }.forEach { | ||
it.addAll(wins[result.winner]) | ||
} | ||
} |
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.
플루이드 워셜을 안하고도 이런식으로 구할 수 있군요 👍 👍
} | ||
} else { // 주차 빼내기 | ||
val outCar = order.absoluteValue | ||
val parkingLot = parkingLotsCars.indexOfFirst { it == outCar } // 주차 뺄 자리 찾기 |
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.
그냥 indexOf하면 first가 안나오나요? 😮
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.
println(listOf(5,1,1).indexOf(1))
---
ouput
1
first 가 나오네요!
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.
아항~~ 감사합니다
roads = MutableList(n) { mutableListOf() } | ||
repeat(m) { | ||
val (a, b, t) = readLine().split(' ').map { it.toInt() } | ||
if (a in cant || b in cant) return@repeat |
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이면 아예 roads에 넣어주지 않아주면 깔끔하겠네요 👍 👍
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.
고생하셨습니다!!
readLine().split(' ').map { it.toInt() }.forEachIndexed { index, it -> | ||
if (it == 1 && index != n - 1) cant.add(index) | ||
} |
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.
오 아예 입력받을 때 요렇게 넥서스를 배제할 수도 있겠군요
if (priorTops.isEmpty()) { | ||
priorTops.add(top) | ||
return@forEachIndexed | ||
} |
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.
어? 그렇네요?? 👍👍🙇♂️
roads = MutableList(n) { mutableListOf() } | ||
repeat(m) { | ||
val (a, b, t) = readLine().split(' ').map { it.toInt() } | ||
if (a in cant || b in cant) return@repeat |
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 | ||
results.map { it.toResult() }.forEach { result -> | ||
wins[result.winner].add(result.loser) | ||
wins[result.winner].addAll(wins[result.loser]) | ||
|
||
wins.filter { result.winner in it }.forEach { | ||
it.addAll(wins[result.winner]) | ||
} | ||
} | ||
|
||
// lose | ||
results.map { it.toResult() }.forEach { result -> | ||
loses[result.loser].add(result.winner) | ||
loses[result.loser].addAll(loses[result.winner]) | ||
|
||
loses.filter { result.loser in it }.forEach { | ||
it.addAll(loses[result.loser]) | ||
} | ||
} |
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 📌
📋문제 목록📋