-
[백준 문제풀이] 얼렁뚱땅 1966번 프린터 큐 풀이얼렁뚱땅 백준 문제풀이 2022. 8. 11. 15:37
https://www.acmicpc.net/problem/1966 from collections import deque test = int(input()) answer = [] for i in range(test) : n, m = map(int,input().split()) list_ = list(enumerate(map(int,input().split()))) sorted_ = sorted(list(list(zip(*list_))[1]), reverse=True) q = deque(list_) k = 0 count = 0 while q : target = sorted_[k] hey = q.popleft() if hey[1] != target : q.append(hey) else : count += 1 k += 1 if hey[0] == m : break answer.append(count) for i in answer : print(i)
'얼렁뚱땅 백준 문제풀이' 카테고리의 다른 글
[백준 문제풀이] 얼렁뚱땅 16719 ZOAC 풀이 (0) 2022.08.11 [백준 문제풀이] 얼렁뚱땅 20207번 달력 풀이 (0) 2022.08.11 [백준 문제풀이] 얼렁뚱땅 2812번 크게 만들기 (0) 2022.08.10 [백준 문제풀이] 얼렁뚱땅 22856번 트리 순회 풀이 (0) 2022.08.10 [백준 문제풀이] 얼렁뚱땅 4358번 생태학 풀이 (0) 2022.08.10