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

[최단 경로] 2171039 이채원 #350

Open
wants to merge 3 commits into
base: 2171039-이채원
Choose a base branch
from

Conversation

chae-jpg
Copy link

인적사항

학번: 2171039
이름: 이채원


과제 제출

기존 제출 : 1238, 2458
추가 제출 : 15685


@Dong-droid
Copy link
Contributor

코드리뷰완료
수고하셨습니다 😸

Comment on lines +50 to +63

//정점 별로 모든 정점에 대한 최단경로를 구함.
for (int i = 1; i <= n; i++) {
dist[i] = dijkstra(i, n, graph);
}

vector<int> dist_sum = dijkstra(x, n, graph); //파티장에서 모든 정점으로 돌아오는 최단 경로

//파티장에서 돌아오는 정점에 정점에서 파티장으로 가는 최단경로의 합을 구함.
for (int i = 1; i <= n; i++) {
dist_sum[i] += dist[i][x];
max_dist = max(max_dist, dist_sum[i]); //최댓값 갱신
}

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 +24 to +36

for (int i = 1; i <= n; i++) {
if (graph[node][i] == INF) { //연결되어 있지 않는 노드일 때
q.push(i);
}
}

while (!q.empty()) {
if (graph[q.front()][node] == INF) { //반대로도 연결되어 있지 않을 때 -> 키 순서 파악 불가.
return false;
}
q.pop();
}
Copy link
Contributor

@Dong-droid Dong-droid May 30, 2023

Choose a reason for hiding this comment

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

P3. queue를 사용해도 되지만

    for(int i = 1; i <=n; i++) 
        if(graph[node][i] == INF && graph[i][node] == INF) return false;

를 사용해서 for문으로도 구현할 수 있습니다~

Copy link
Contributor

@jk0527 jk0527 left a comment

Choose a reason for hiding this comment

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

[최단 경로 구현 문제 추가 제출 확인 완료]

추가 제출 확인했습니다!🥰🥰
수고하셨습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants