카테고리 없음

백준 1966번 : 프린터 큐 (Python, 파이썬) - 자료구조 큐(Deque)

에르미타쥬 2019. 1. 14. 23:19

https://www.acmicpc.net/problem/1966

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
= 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 = 0
    if len(imp) == N:
        while True:
            if imp[0== max(imp):
                cnt += 1
                if judge[0== 'T':
                    print(cnt)
                    break
                else:
                    imp.pop(0)
                    judge.pop(0)
            else:
                imp.append(imp.pop(0))
                judge.append(judge.pop(0))
cs