백준 1021 회전하는 큐 (1) 썸네일형 리스트형 [ BOJ / 파이썬 ] 1021 회전하는 큐 / 제출 1 / import sys input = sys.stdin.readline from collections import deque n, m = map(int, input().split()) q = deque([i+1 for i in range(n)]) target = deque(list(map(int, input().split()))) result = 0 for t in target: left = q.index(t) right = len(q) - left if left < right: while True: curr = q.popleft() if curr == t: break q.append(curr) result += 1 else: newLeft = [] while True: curr = q.po.. 이전 1 다음