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

[소병희] 알고스팟, A와 B 2, 회장뽑기, 입국심사 #188

Merged
merged 4 commits into from
Oct 8, 2023

Conversation

bngsh
Copy link
Contributor

@bngsh bngsh commented Oct 8, 2023

📌 from issue #185 📌

📋문제 목록📋

알고스팟: ✅
A와 B 2: ✅
회장뽑기: ✅
입국심사: ⛔

@bngsh bngsh self-assigned this Oct 8, 2023
@bngsh bngsh added the 병희 label Oct 8, 2023
@bngsh bngsh changed the title [소병희] 알고스팟, A와 B 2, 회장뽑기 [소병희] 알고스팟, A와 B 2, 회장뽑기, 입국심사 Oct 8, 2023
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.

고생하셨습니다!!

val s = readLine()
val t = readLine()

fun checkAB(sb: StringBuilder): Boolean {
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 +37 to +42
if (maze[nr][nc] == ROOM) {
pq.add(intArrayOf(d, nr, nc))
}
else if (maze[nr][nc] == WALL) {
pq.add(intArrayOf(d+1, nr, nc))
}
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 +30 to +36
for(k in 0 until n) {
for(i in 0 until n) for(j in 0 until n) {
val before = adj[i][j]
val detour = adj[i][k] + adj[k][j]
if (detour < before) adj[i][j] = detour
}
}
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 +11 to +12
if (s == sb.toString()) return true
if (s.length == sb.length) return false
Copy link
Member

Choose a reason for hiding this comment

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

오 깔끔해용

val (n, m) = readLine().split(" ").map { it.toInt() }
val maze = Array(m) { IntArray(n) }
val dist = Array(m) { IntArray(n) { INF } }
val pq = PriorityQueue<IntArray> { a, b -> a[0] - b[0] }
Copy link
Member

Choose a reason for hiding this comment

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

pq를 이용한 bfs는 0-1bfs랑 같은 효과가 있군요 !

Comment on lines +41 to +51
for(i in 0 until n) {
val score = adj[i].maxOf{it}
if (score < minScore) {
minScore = score
candidates.clear()
candidates.add(i + 1)
}
else if (score == minScore) {
candidates.add(i + 1)
}
}
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 +11 to +12
if (s == sb.toString()) return true
if (s.length == sb.length) return false
Copy link
Member

Choose a reason for hiding this comment

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

이렇게 if 두 개로 판단하는 게 좋았슴다!

Comment on lines +11 to +16
while(lb + 1 < ub) {
mid = lb + (ub - lb) / 2
val cost = times.sumOf { mid / it }
if (cost < n) lb = mid
else ub = mid
}
Copy link
Member

Choose a reason for hiding this comment

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

굿굿👍👍
동작 과정을 다시 봐야겠슴다!

@bngsh bngsh merged commit 036921a into main Oct 8, 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