-
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
[13 최단경로] 1914039 최유진 #358
base: 1914039-최유진
Are you sure you want to change the base?
Conversation
P1. 코드리뷰완료 |
int Cost = -PQ.top().first; | ||
int Cur = PQ.top().second; | ||
PQ.pop(); //coast와 cur에 저장한 다음 pop | ||
|
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.
P1. 다익스트라의 핵심적인 부분이 빠졌습니다!!! 다른 문제의 경우에 이 부분을 빠뜨리면 시간 초과가 나는 경우가 많습니다. 다익스트라의 그리디 최적해는 최소 정점을 뽑고, 어떤 경우 ❓ 에 무시를 하게 됩니다! 이 를 어떻게 구현했었죠??
13_최단 경로/필수/1238.cpp
Outdated
void Solution() { | ||
|
||
for (int i = 1; i <= N; i++) { | ||
for (int j = 1; j <= N; j++) { | ||
Dist[j] = INF; | ||
} | ||
Dijkstra(i); | ||
Res[i] = Dist[X]; | ||
} | ||
for (int j = 1; j <= N; j++) { | ||
Dist[j] = INF; | ||
} | ||
|
||
Dijkstra(X); | ||
for (int i = 1; i <= N; i++) { | ||
Res[i] = Res[i] + Dist[i]; | ||
} | ||
|
||
sort(Res + 1, Res + N + 1);// 가장 큰 값을 찾기 위해 정렬 | ||
int Answer = Res[N];//가장 큰 값 | ||
|
||
cout << Answer; | ||
} | ||
|
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. 그런데, 변수 이름에 Answer 이렇게 첫 문자만 대문자로 하는 이유가 있나요?? snake case와 camel case 둘다 아닌 것 같은데요!! answer로 하시는 게 클린 코드에 더 부합하는 것 같습니다 😉
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.
[최단 경로 구현 문제 추가 제출 확인 완료]
추가 제출 확인했습니다!🥰🥰
수고하셨습니다!
인적사항
학번: 1914039
이름: 최유진
과제 제출
기존 제출 : 1238
추가 제출 : 2458, 15685