본문 바로가기

황소개발자

검색하기
황소개발자
프로필사진 hjp845

  • 분류 전체보기 (181)
    • 백준 문제 풀이 (154)
    • 투자자의 생각 (5)
    • 각종 에러 잡기 (10)
    • 앱개발 (8)
    • 매일 11시 영어 (0)
    • 유유자적하게 글쓰기 (0)
Guestbook
반응형
Notice
Recent Posts
Recent Comments
Link
  • 실전언어 연구소
«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
  • LCS
  • expo
  • 9095
  • 파이썬
  • 순열
  • 1260
  • 1182
  • 11기
  • 11054
  • 코테
  • 뒤로가기
  • 6603
  • itertools
  • Python
  • Combination
  • 코틀린
  • 앱
  • 최소공배수
  • 백준
  • 홈화면
  • 나머지
  • 11057
  • 괄호
  • 11053
  • 매일11시
  • lcm
  • 안드로이드
  • Kotlin
  • permutation
  • Android
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록1753 (1)

황소개발자

백준 1753 파이썬 python : 최단경로 @@황소처럼 우직하게@@

다익스트라는 Greedy 와 BFS 를 섞은 느낌이다 BFS에서 대신 q를 쓸 때, min heap q를 사용한다. 그래야 다음으로 가장 짧은 노드를 빠르게 찾을 수 있으니. import sys import heapq inpu = sys.stdin.readline INF = 999999999 def dijkstra(v, start, g): dist = [INF] * (V + 1) dist[start] = 0 q = [] heapq.heappush(q, [0, start]) while q: cost, loc = heapq.heappop(q) for l, c in g[loc]: c += cost if c < dist[l]: dist[l] = c heapq.heappush(q, [c, l]) return di..

백준 문제 풀이 2020. 2. 22. 02:12
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바