-
Notifications
You must be signed in to change notification settings - Fork 0
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
17-seongwon030 #67
17-seongwon030 #67
Conversation
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.
γ γ γ γ μ€λ§ μ± μ μλ κ²μ κ·Έλλ‘..?
μ΅μ μ μ₯ νΈλ¦¬λ λνμ μΌλ‘ νλ¦Ό, ν¬λ£¨μ€μΉΌ μκ³ λ¦¬μ¦μ΄ μ‘΄μ¬νμ£
κ·Έλνλ₯Ό μ΄μ λ 거리λ₯Ό κΈ°μ€μΌλ‘ μ°κ²°ν κ²μ΄λ? μλλ©΄ μ΄λ ν λ
Έλμμ 짧μ κ°μ λ€μ μ°κ²°νμ¬ μ°κ²°ν κ²μ΄λλ‘ λλκ² λ죡
μ¬κΈ°μ λ λμκ°λ©΄ union-findλ μ μ©ν μ μλλ° μ΄κ²λ€ λͺ¨λ λ€ κ²½νν΄μ λ§μ€ν°ν΄λ³΄λ κ²μ μΆμ²λλ¦Όλλ€!
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.
λ΅μ λ¬μμ£Όμ§ μλκ΅°μ.. μ΅κ·Ό MSTμ λΉ μ§μ κ² κ°λ€μ γ γ μ΄ μ°Έμ μμ μ 볡 νμκΈΈ
edge.append(list(map(int,input().split()))) | ||
|
||
# λΉμ©μ κΈ°μ€μΌλ‘ μ€λ¦μ°¨μ | ||
edge.sort(key=lambda x:x[2]) |
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.
μ¬κΈ°λ x[2] λ₯Ό κΈ°μ€μΌλ‘ μ λ ¬νλ€λ μλ―ΈμΈκ°μ?
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.
λ΅ν΄μ€
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.
ν μ λ΅μ μνμ§! λ€ λ§μ΅λλΉ
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.
μλ‘
(lambda x,y: x + y)(10, 20)
λ 10κ³Ό 20μ λν κ°μΈ 30μ΄ λμ€λλ°
lambda 맀κ°λ³μ : ννμ
μΌλ‘ νμ΄μ¬μμλ ννν΄μ.
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.
λλ€ν¨μλ λ΄λλ΄λ ν·κ°λ¦¬λ€μ..
π λ¬Έμ λ§ν¬
μ΅μμ€ν¨λνΈλ¦¬
βοΈ μμλ μκ°
1μκ° 30λΆ
β¨ μλ μ½λ
ν¬λ£¨μ€μΉΌ μκ³ λ¦¬μ¦
κ°μ€μΉκ° λμ κ°μ μ μ κ±°νλ©΄μ μ΅μ λΉμ© μ μ₯ νΈλ¦¬λ₯Ό λ§λλ μκ³ λ¦¬μ¦
μμ
μμ
=> κ°μ€μΉκ° 17μΈ κ°μ (A,C) μ κ±°
2. λ€μμΌλ‘ λμ κ°μ€μΉμ κ°μ μ μ κ±°νλ€.
=> κ°μ€μΉκ° 14μΈ κ°μ (F,G)μ κ±°
3. λ¨μ κ°μ μ€ κ°μ€μΉκ° κ°μ₯ λμ κ°μ (B,G)λ₯Ό μ κ±°νλ€.
4. λ¨μ κ°μ μ€ κ°μ€μΉκ° κ°μ₯ λμ κ°μ (C,E)λ₯Ό μ κ±°νλ€.
5.λ¨μ κ°μ μ€ κ°μ€μΉκ° κ°μ₯ λμ κ°μ (D,E)λ₯Ό μ κ±°νλ©΄ κ·Έλνκ° λΆλ¦¬λμ΄ λ¨μ κ·Έλνκ° λλ€. κ·Έ λ€μμΌλ‘ λμ κ°μ€μΉμ κ°μ (C,F)λ₯Ό μ κ±°νλ€. νμ§λ§ (C,F)λ₯Ό μ κ±°νλ©΄ μ μ Cκ° λΆλ¦¬λλ―λ‘ μ κ±°ν μ μλ€. κ·Έλ¬λ―λ‘ λ€μμΌλ‘ κ°μ€μΉκ° λμ κ°μ (A,D)λ₯Ό μ κ±°νλ€.
6. νμ¬ λ¨μ κ°μ μκ° 6κ°μ΄λ―λ‘ μ μ 7κ°, κ°μ 6κ°λ‘ μκ³ λ¦¬μ¦ μνμ μ’ λ£νλ©΄ μ μ₯ νΈλ¦¬κ° μμ±λλ€.
findν¨μ
μ£Όμ΄μ§ λ Έλ xμ μ΅μμ λΆλͺ¨(루νΈλ Έλ)λ₯Ό μ°Ύλλ€. κ²½λ‘ μμΆμ ν΅ν΄ νΈλ¦¬μ λμ΄λ₯Ό μ€μ΄λ μν μ νλ€.
ν¬λ£¨μ€μΉΌμ μ΄μ©ν MST
μλ‘κ² μκ² λ μ
μλ£κ΅¬μ‘° λ°°μΈ λ μ μ΄λ°κ±°κ΅¬λ νκ³ λμ΄κ°μλλ° μ λλ‘ λ°°μ°λκΉ μ¬λ°λ€μ