244451 백준-24445번(알고리즘 수업 - 너비 우선 탐색 2)-python 백준-24445번(알고리즘 수업 - 너비 우선 탐색 2)-python 24444번 문제에서 for x in adl: x.sort() 이 부분을 for x in adl: x.sort(reverse=True) 이렇게 변경해주면 되었다. from collections import deque import sys input = sys.stdin.readline V,E,R=map(int,input().split()) visited=[0]*(V+1) adl=[[] for _ in range(V+1)] cnt=1 for _ in range(E): m,n=map(int,input().split()) adl[m].append(n) adl[n].append(m) for x in adl: x.sort(reverse=True).. 2023. 11. 23. 이전 1 다음