Skip to content

Commit 01abd5d

Browse files
committed
[Silver II] Title: 트리의 부모 찾기, Time: 208 ms, Memory: 91504 KB -BaekjoonHub
1 parent 521afb8 commit 01abd5d

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

백준/Silver/11725. 트리의 부모 찾기/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
### 성능 요약
66

7-
메모리: 89004 KB, 시간: 240 ms
7+
메모리: 91504 KB, 시간: 208 ms
88

99
### 분류
1010

1111
그래프 이론, 그래프 탐색, 트리, 너비 우선 탐색, 깊이 우선 탐색
1212

1313
### 제출 일자
1414

15-
2025년 5월 28일 22:37:35
15+
2025년 5월 28일 22:38:57
1616

1717
### 문제 설명
1818

백준/Silver/11725. 트리의 부모 찾기/트리의 부모 찾기.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var parent = [Int](repeating: 0, count: n+1)
99
var tree = [[Int]](repeating: [Int](), count: n+1)
1010
var queue = [1]
1111

12-
(0..<n-1).forEach { _ in
12+
for _ in 0..<n-1 {
1313
let gv = readLine()!.split { $0 == " " }.map { Int(String($0))! },
1414
g = gv[0],
1515
v = gv[1]
@@ -27,6 +27,4 @@ while queue.count > index {
2727
index += 1
2828
}
2929

30-
for i in 2...n {
31-
print(parent[i])
32-
}
30+
print(parent[2...].map { "\($0)\n"}.joined())

0 commit comments

Comments
 (0)