-
Notifications
You must be signed in to change notification settings - Fork 37
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
[최단 경로] 2171064 문하영 #354
base: 2171064-문하영2
Are you sure you want to change the base?
[최단 경로] 2171064 문하영 #354
Conversation
코드리뷰완료 |
graph[s].push_back({e, T}); | ||
} | ||
//연산 | ||
vector<int> dist_x = dijkstra(x, n, graph); //최단 시간 저장 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
미리 저장하는 거 너무 좋습니다~ 👍
for (int i = 1; i <= n; i++) { | ||
vector<int> dist_i = dijkstra(i, n, graph); // i -> X의의 최단 시간 | ||
max_T = max(max_T, dist_x[i] + dist_i[x]); //max_T 갱신 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 🥇
//출력 | ||
int ans = 0; | ||
for(int i=1; i<=N; i++){ | ||
bool flag = true; | ||
for(int j=1; j<=N; j++){ | ||
if(i == j) continue; | ||
else if(graph[i][j] == INF && graph[j][i] == INF){ | ||
flag = false; //i와 j 사이의 가중치가 없는 경우 | ||
break; | ||
} | ||
} | ||
if(flag) { | ||
ans++; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3. else if 일 필요는 없을 것 같아요. 앞에서 continue;이니까 if만 써줘도 될 것 같아요~
인적사항
학번: 2171064
이름: 문하영
과제 제출
기존 제출 : 1238, 2458
추가 제출 : 15685