
N,M = map(int,input().split())
array = [i for i in range(1,N+1)]
for _ in range(M):
i,j = map(int,input().split())
array[i-1], array[j-1] = array[j-1], array[i-1]
print(*array)
이전에 풀었던 공 넣기와 유사한 형태
| [파이썬/python] 백준 24416번 : 알고리즘 수업 - 피보나치 수 1 (🥉1) (0) | 2023.03.23 |
|---|---|
| [파이썬/python] 백준 10811번 : 바구니 뒤집기 (🥉2) (0) | 2023.03.23 |
| [파이썬/python] 백준 10810번 : 공 넣기 (🥉3) (0) | 2023.03.23 |
| [파이썬/python] 프로그래머스 : 가운데 글자 가져오기 (Lv.1) (0) | 2023.03.15 |
| [파이썬/python] 프로그래머스 : 없는 숫자 더하기 (Lv.1) (0) | 2023.03.15 |