-
백준 1966번 : 프린터 큐 (Python, 파이썬) - 자료구조 큐(Deque)카테고리 없음 2019. 1. 14. 23:19
https://www.acmicpc.net/problem/1966
12345678910111213141516171819202122T = int(input())for _ in range(T):NM = list(map(int,input().split(' ')))N = NM[0]M = NM[1]imp = list(map(int,input().split(' ')))judge = [0 for _ in range(N)]judge[M] = 'T'cnt = 0if len(imp) == N:while True:if imp[0] == max(imp):cnt += 1if judge[0] == 'T':print(cnt)breakelse:imp.pop(0)judge.pop(0)else:imp.append(imp.pop(0))judge.append(judge.pop(0))cs