From cd7d5163a81c4560ee4252e001830f5691c4488b Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 28 Jun 2025 23:39:46 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[BOJ]=20=ED=8A=B9=EC=A0=95=ED=95=9C=20?= =?UTF-8?q?=EC=B5=9C=EB=8B=A8=20=EA=B2=BD=EB=A1=9C=20/=20=EA=B3=A8?= =?UTF-8?q?=EB=93=9C=204=20/=2070=EB=B6=84=20=EC=8B=A4=ED=8C=A8=20?= =?UTF-8?q?=ED=9E=8C=ED=8A=B8=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/1504 --- ...4\353\213\250 \352\262\275\353\241\234.py" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "YoonYn9915/dijkstra/2025-06-23-[\353\260\261\354\244\200]-#1504-\355\212\271\354\240\225\355\225\234 \354\265\234\353\213\250 \352\262\275\353\241\234.py" diff --git "a/YoonYn9915/dijkstra/2025-06-23-[\353\260\261\354\244\200]-#1504-\355\212\271\354\240\225\355\225\234 \354\265\234\353\213\250 \352\262\275\353\241\234.py" "b/YoonYn9915/dijkstra/2025-06-23-[\353\260\261\354\244\200]-#1504-\355\212\271\354\240\225\355\225\234 \354\265\234\353\213\250 \352\262\275\353\241\234.py" new file mode 100644 index 0000000..a84f810 --- /dev/null +++ "b/YoonYn9915/dijkstra/2025-06-23-[\353\260\261\354\244\200]-#1504-\355\212\271\354\240\225\355\225\234 \354\265\234\353\213\250 \352\262\275\353\241\234.py" @@ -0,0 +1,35 @@ +import sys +import heapq + +input = sys.stdin.readline +INF = float('inf') + +N, E = map(int, input().split()) +graph = [[] for _ in range(N + 1)] +for _ in range(E): + a, b, c = map(int, input().split()) + graph[a].append((b, c)) + graph[b].append((a, c)) +v1, v2 = map(int, input().split()) + + + +def dijkstra(start, end): + dist = [INF] * (N + 1) + dist[start] = 0 + hq = [(0, start)] + while hq: + len, node = heapq.heappop(hq) + if len > dist[node]: + continue + for next_node, val in graph[node]: + if dist[next_node] > dist[node] + val: + dist[next_node] = dist[node] + val + heapq.heappush(hq, (dist[next_node], next_node)) + return dist[end] + + +path1 = dijkstra(1, v1) + dijkstra(v1, v2) + dijkstra(v2, N) +path2 = dijkstra(1, v2) + dijkstra(v2, v1) + dijkstra(v1, N) + +print(-1) if path1 >= INF and path2 >= INF else print(min(path1, path2)) From 263674e6c0e3734d98baeac566cacad1e8051023 Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 28 Jun 2025 23:41:57 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[BOJ]=EC=B5=9C=EB=8B=A8=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20/=20=EA=B3=A8=EB=93=9C=205=20/=2045=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/1753 --- ...4\353\213\250 \352\262\275\353\241\234.py" | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 "YoonYn9915/dijkstra/2025-06-28-[\353\260\261\354\244\200]-#1753-\354\265\234\353\213\250 \352\262\275\353\241\234.py" diff --git "a/YoonYn9915/dijkstra/2025-06-28-[\353\260\261\354\244\200]-#1753-\354\265\234\353\213\250 \352\262\275\353\241\234.py" "b/YoonYn9915/dijkstra/2025-06-28-[\353\260\261\354\244\200]-#1753-\354\265\234\353\213\250 \352\262\275\353\241\234.py" new file mode 100644 index 0000000..34bcea3 --- /dev/null +++ "b/YoonYn9915/dijkstra/2025-06-28-[\353\260\261\354\244\200]-#1753-\354\265\234\353\213\250 \352\262\275\353\241\234.py" @@ -0,0 +1,41 @@ +import heapq +import sys + +input = sys.stdin.readline + +V, E = map(int, input().split()) +start = int(input()) +graph = [[] for _ in range(V + 1)] + +for _ in range(E): + u, v, w = map(int, input().split()) + + graph[u].append((v, w)) + + +def dijkstra(start): + distances = [float("inf")] * (V + 1) + distances[start] = 0 + q = [] + heapq.heappush(q, (distances[start], start)) + + while q: + cnt_distance, node = heapq.heappop(q) + + if distances[node] < cnt_distance: + continue + + for adjacency_node, distance in graph[node]: + cal_distance = distances[node] + distance + + if cal_distance < distances[adjacency_node]: + distances[adjacency_node] = cal_distance + heapq.heappush(q, (cal_distance, adjacency_node)) + + return distances + + +result = dijkstra(start) + +for i in range(1, len(result)): + print("INF" if result[i] == float("inf") else result[i]) \ No newline at end of file From 685ff9b1eae7f01d01abc70ef010301c5a14e49d Mon Sep 17 00:00:00 2001 From: YoonYn9915 Date: Sat, 28 Jun 2025 23:47:24 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[BOJ]=EC=8A=A4=ED=85=94=EB=9D=BC=EA=B0=80?= =?UTF-8?q?=20=EC=B9=98=ED=82=A8=EC=9D=84=20=EC=84=A0=EB=AC=BC=ED=96=88?= =?UTF-8?q?=EC=96=B4=EC=9A=94=20/=20=EC=8B=A4=EB=B2=84=205=20/=2025?= =?UTF-8?q?=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.acmicpc.net/problem/15905 --- ...274\355\226\210\354\226\264\354\232\224.py" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "YoonYn9915/implementation/2025-06-28-[\353\260\261\354\244\200]-#15905-\354\212\244\355\205\224\353\235\274\352\260\200 \354\271\230\355\202\250\354\235\204 \354\204\240\353\254\274\355\226\210\354\226\264\354\232\224.py" diff --git "a/YoonYn9915/implementation/2025-06-28-[\353\260\261\354\244\200]-#15905-\354\212\244\355\205\224\353\235\274\352\260\200 \354\271\230\355\202\250\354\235\204 \354\204\240\353\254\274\355\226\210\354\226\264\354\232\224.py" "b/YoonYn9915/implementation/2025-06-28-[\353\260\261\354\244\200]-#15905-\354\212\244\355\205\224\353\235\274\352\260\200 \354\271\230\355\202\250\354\235\204 \354\204\240\353\254\274\355\226\210\354\226\264\354\232\224.py" new file mode 100644 index 0000000..efeee6a --- /dev/null +++ "b/YoonYn9915/implementation/2025-06-28-[\353\260\261\354\244\200]-#15905-\354\212\244\355\205\224\353\235\274\352\260\200 \354\271\230\355\202\250\354\235\204 \354\204\240\353\254\274\355\226\210\354\226\264\354\232\224.py" @@ -0,0 +1,18 @@ +N = int(input()) + +arr = [] + +for _ in range(N): + q, p = list(map(int, input().split())) + arr.append([q, p]) + +arr.sort(reverse=True) + +count = 0 +for i in range(5, len(arr)): + if arr[4][0] == arr[i][0]: + count += 1 + else: + break + +print(count) \ No newline at end of file