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

[장희직] - 겹치는 건 싫어, 쉬운 최단거리, 회전 초밥, 기타리스트 #168

Merged
merged 4 commits into from
Sep 3, 2023

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Sep 3, 2023

📌 from issue #165 📌

📋문제 목록📋

겹치는 건 싫어: ✅
쉬운 최단거리: ✅
회전 초밥: ✅
기타리스트: ⛔️

📝메모

기타리스트..........

@jhg3410 jhg3410 added the 희직 label Sep 3, 2023
@jhg3410 jhg3410 self-assigned this Sep 3, 2023
if (numberCount == k) {
answer = max(answer, stored.size)
while (true) {
val removeNumber = stored.removeFirst()
Copy link
Contributor

Choose a reason for hiding this comment

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

오 큐로 처리하는 거 못지네요

m = this[2]
}
differences = readln().split(' ').map { it.toInt() }.toMutableList()
dp = MutableList(n + 1) { MutableList(m + 1) { false } }
Copy link
Contributor

@bngsh bngsh Sep 3, 2023

Choose a reason for hiding this comment

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

아마 범위가 0에서m으로 제한되니까 매 곡마다 0-m범위만 확인하면 되서 2^n까지 안 가게 되는 거 아닐까요...! 앞서서 범위를 초과하는 경우의수를 차단해버리면 뒤에선 그 경우의 수를 탐색하지 않아도 돼서...!? 이게 아니었군요 ㅋㅋㅋ 재귀면 특정 깊이에서 같은 값인 경우가 중복돼서인가봐요

Copy link
Member Author

Choose a reason for hiding this comment

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

명강의 감사합니다 크 👍👍👍👍👍

var m by Delegates.notNull<Int>()
val board = mutableListOf<MutableList<Int>>()

fun solve() = with(System.`in`.bufferedReader()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

헐 훨씬 짧아지네요 바로 따라해

Copy link
Member

Choose a reason for hiding this comment

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

와 좋다

}

repeat(n) { i ->
val partBeltSet = belt.subList(i, i + k).toSet()
Copy link
Contributor

Choose a reason for hiding this comment

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

toSet 똑똑하네요...set.add로 하려고 했었는데!!

}
}

return dp[n].lastIndexOf(true)
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 +33 to +37
while (true) {
val removeNumber = stored.removeFirst()
counts[removeNumber]--
if (removeNumber == number) break
}
Copy link
Member

Choose a reason for hiding this comment

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

while문으로 미리 갱신해버리는거 좋네용

Comment on lines +33 to +37
while (true) {
val removeNumber = stored.removeFirst()
counts[removeNumber]--
if (removeNumber == number) break
}
Copy link
Member

Choose a reason for hiding this comment

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

연산을 아주 효율적으로 동작시키셨군요!

var m by Delegates.notNull<Int>()
val board = mutableListOf<MutableList<Int>>()

fun solve() = with(System.`in`.bufferedReader()) {
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 +28 to +31
val row = readLine().split(' ').map {
if (it == "1") -1
else it.toInt()
}
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 +32 to +34
if (row.contains(2)) {
target = Pos(x = it, y = row.indexOf(2))
}
Copy link
Member

Choose a reason for hiding this comment

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

요거 항상 참인 조건문 아닌가요?

@jhg3410 jhg3410 merged commit 2cb587f into main Sep 3, 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