https://www.acmicpc.net/problem/1966
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from collections import deque
for i in range(int(input())):
n, m = map(int, input().split())
waiting= deque(list(map(int,input().split())))
importance = deque(list([i for i in range(n)]))
cnt = 0
while waiting:
if waiting[0] == max(waiting):
cnt+=1
waiting.popleft()
if importance.popleft() == m:
print(cnt)
else:
waiting.append(waiting.popleft())
importance.append(importance.popleft())
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 4949 균형잡힌 세상 (0) | 2022.11.09 |
---|---|
백준 18398 HOMWRK (0) | 2022.11.09 |
백준 10816 숫자 카드 2 (0) | 2022.11.08 |
백준 11866 요세푸스 문제 0 (0) | 2022.11.08 |
Hacker rank Super Reduced String (0) | 2022.11.08 |
댓글