Skip to content

플로이드#132

Merged
github-actions[bot] merged 1 commit into
mainfrom
liv
Apr 14, 2026
Merged

플로이드#132
github-actions[bot] merged 1 commit into
mainfrom
liv

Conversation

@sangYuLv
Copy link
Copy Markdown
Collaborator

🔗 문제 링크

✔️ 소요된 시간

50분

⏰ 시간 복잡도

O(n^3)

@sangYuLv sangYuLv self-assigned this Apr 14, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements the Floyd-Warshall algorithm to solve the all-pairs shortest path problem for Baekjoon 11404. The implementation correctly handles multiple edges between nodes and initializes the distance matrix appropriately. Feedback was provided regarding the performance of standard input methods, suggesting the use of a faster I/O approach for large datasets to ensure efficiency within time limits.

var graph = [[Int]](repeating: basic, count: cityCount+1)

for _ in 1...busCount {
let line = readLine()!.split(separator: " ").compactMap { Int($0) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

입력 데이터의 양($M \le 100,000$)이 많을 때 readLine()split을 반복적으로 호출하는 것은 Swift에서 성능 저하의 주요 원인이 될 수 있습니다. 현재 문제의 시간 제한(2초) 내에는 통과할 가능성이 높지만, 데이터가 더 많거나 시간 제한이 촉박한 경우에는 FileIO와 같은 더 빠른 입력 방식을 사용하는 것이 권장됩니다.

@github-actions github-actions Bot merged commit 49ccdfa into main Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant