diff --git a/zeta_python/1966.py b/zeta_python/1966.py deleted file mode 100644 index 8eda821..0000000 --- a/zeta_python/1966.py +++ /dev/null @@ -1,16 +0,0 @@ -from collections import deque - - -def case(N, M, I): - q_id = deque(range(N)) - q_priority = deque(I) - - q_m_p = q_priority[M] - - q_id - - -if __name__ == "__main__": - T = int(input()) - for _ in range(T): - print(case(*map(int, input().split()), list(map(int, input().split())))) diff --git a/zeta_python/completed/1966.py b/zeta_python/completed/1966.py new file mode 100644 index 0000000..cb135e1 --- /dev/null +++ b/zeta_python/completed/1966.py @@ -0,0 +1,24 @@ +import sys + +input = sys.stdin.readline + + +# 너무 개같이 짬 PriorityQueue로 구현할 수 있지 않을까? +def case(N, M, I): + D = [(v, i) for i, v in enumerate(I)] + cnt = 0 + while D: + most = max(D)[0] + w, ind = D.pop(0) + if w == most: + cnt += 1 + if ind == M: # if target + return cnt + else: + D.append((w, ind)) + + +if __name__ == "__main__": + T = int(input()) + for _ in range(T): + print(case(*map(int, input().split()), list(map(int, input().split()))))