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

[장희직] - 주차장, 순위, 탑 #194

Merged
merged 4 commits into from
Oct 15, 2023
Merged

[장희직] - 주차장, 순위, 탑 #194

merged 4 commits into from
Oct 15, 2023

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Oct 15, 2023

📌 from issue #190 📌

📋문제 목록📋

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

@jhg3410 jhg3410 added the 희직 label Oct 15, 2023
@jhg3410 jhg3410 self-assigned this Oct 15, 2023
Comment on lines +18 to +25
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])
}
}
Copy link
Member

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 } // 주차 뺄 자리 찾기
Copy link
Member

Choose a reason for hiding this comment

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

그냥 indexOf하면 first가 안나오나요? 😮

Copy link
Member Author

Choose a reason for hiding this comment

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

image

indexOf 함수엔 제가 원하는 파라미터를 받는 친구가 없었어서 ㅠ

Copy link
Member Author

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 가 나오네요!

Copy link
Member

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

Choose a reason for hiding this comment

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

오 1이면 아예 roads에 넣어주지 않아주면 깔끔하겠네요 👍 👍

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.

고생하셨습니다!!

Comment on lines +24 to +26
readLine().split(' ').map { it.toInt() }.forEachIndexed { index, it ->
if (it == 1 && index != n - 1) cant.add(index)
}
Copy link
Member

Choose a reason for hiding this comment

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

오 아예 입력받을 때 요렇게 넥서스를 배제할 수도 있겠군요

Comment on lines +17 to +20
if (priorTops.isEmpty()) {
priorTops.add(top)
return@forEachIndexed
}
Copy link
Member

Choose a reason for hiding this comment

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

요거 없어도 괜찮지 않을까요???

Copy link
Member Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

아예 길을 끊어버리는거 아주 똑똑합니다

Comment on lines +17 to +35
// 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])
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이걸 계산으로 푸시다니 대박입니당

@jhg3410 jhg3410 merged commit f0c6270 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